Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Sunday, December 5, 2010

runlevel links at boot time with chkconfig

Generally after every server setup, we need to place a few services on startup.  Depending on the operating system, I have tried quite a few techniques right from manually placing scripts in init.d to the ease of update-rc.d(on ubuntu). However, today I would like to showcase another tool - chkconfig, just for the fact that it has some real clean representation,

A chkconfig --list would show you the list of services and their run level configurations.

Sample output on a CentOS installation:
# chkconfig --list
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
acpid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
anacron         0:off   1:off   2:on    3:on    4:on    5:on    6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off
avahi-dnsconfd  0:off   1:off   2:off   3:off   4:off   5:off   6:off
bluetooth       0:off   1:off   2:on    3:on    4:on    5:on    6:off
capi            0:off   1:off   2:off   3:off   4:off   5:off   6:off
conman          0:off   1:off   2:off   3:off   4:off   5:off   6:off
cpuspeed        0:off   1:on    2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
cups            0:off   1:off   2:on    3:on    4:on    5:on    6:off
dnsmasq         0:off   1:off   2:off   3:off   4:off   5:off   6:off
dund            0:off   1:off   2:off   3:off   4:off   5:off   6:off
firstboot       0:off   1:off   2:off   3:on    4:off   5:on    6:off
gpm             0:off   1:off   2:on    3:on    4:on    5:on    6:off
haldaemon       0:off   1:off   2:off   3:on    4:on    5:on    6:off
hidd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
ip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:off
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
irda            0:off   1:off   2:off   3:off   4:off   5:off   6:off
irqbalance      0:off   1:off   2:on    3:on    4:on    5:on    6:off
isdn            0:off   1:off   2:on    3:on    4:on    5:on    6:off
kudzu           0:off   1:off   2:off   3:on    4:on    5:on    6:off
lvm2-monitor    0:off   1:on    2:on    3:on    4:on    5:on    6:off
mcstrans        0:off   1:off   2:on    3:on    4:on    5:on    6:off
mdmonitor       0:off   1:off   2:on    3:on    4:on    5:on    6:off
mdmpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
messagebus      0:off   1:off   2:off   3:on    4:on    5:on    6:off
microcode_ctl   0:off   1:off   2:on    3:on    4:on    5:on    6:off
multipathd      0:off   1:off   2:off   3:off   4:off   5:off   6:off
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
netplugd        0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
nscd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
oddjobd         0:off   1:off   2:off   3:off   4:off   5:off   6:off
pand            0:off   1:off   2:off   3:off   4:off   5:off   6:off
pcscd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
portmap         0:off   1:off   2:off   3:on    4:on    5:on    6:off
psacct          0:off   1:off   2:off   3:off   4:off   5:off   6:off
rawdevices      0:off   1:off   2:off   3:on    4:on    5:on    6:off
rdisc           0:off   1:off   2:off   3:off   4:off   5:off   6:off
readahead_early 0:off   1:off   2:on    3:on    4:on    5:on    6:off
readahead_later 0:off   1:off   2:off   3:off   4:off   5:on    6:off
restorecond     0:off   1:off   2:on    3:on    4:on    5:on    6:off
rpcgssd         0:off   1:off   2:off   3:on    4:on    5:on    6:off
rpcidmapd       0:off   1:off   2:off   3:on    4:on    5:on    6:off
rpcsvcgssd      0:off   1:off   2:off   3:off   4:off   5:off   6:off
saslauthd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
smartd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
tcsd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
wpa_supplicant  0:off   1:off   2:off   3:off   4:off   5:off   6:off
xfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
ypbind          0:off   1:off   2:off   3:off   4:off   5:off   6:off
yum-updatesd    0:off   1:off   2:on    3:on    4:on    5:on    6:off

To add a new service to this list, an example in this case - httpd,
# chkconfig --add httpd

The list would now include httpd,
# chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
As seen above, it will not run automatically on any run level. I wanted it to run on 2,3,4 and 5 and hence,
# chkconfig --level 2345 httpd on
And to check the new configuration,
# chkconfig --list | grep httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
A reboot can actually verify whether this configuration works.

chkconfig is not available on Ubuntu by default, but can be installed like so,
# sudo apt-get install chkconfig

Sunday, March 21, 2010

Clearing saved conversations from Empathy IM

Empathy IM is the current default IM client in GNome.

Every time you sign in and open a chat window, it shows all your previous conversations in the same window above. Doing a Conversation > clear or a ctrl+L will only temporarily clear the screen. When you reopen the window, it reappears. It stores all the conversations as text files (xml with .log extensions).

If you do not want Empathy to log your conversations or rather if you just want to remove all the conversations that it has saved, in the current version(2.28.1.1), there is probably no way to clear the saved conversations permanently from the GUI(at least I could not find it yet).

The Empathy logs are stored in the following folder,

/your_home_folder/.local/share/Empathy/logs/

cd ~/.local/share/Empathy/logs/

you should be able to find a folder named after your IM account in there. And inside it, you should be able to see a folder for each of your contact containing logs of previous conversations.

Deleting my IM account folder from Empathy's log folder cleared the previous conversations permanently for me. However, fresh conversations are logged when you use the client again. Hopefully, future versions will have some mechanism to control this chat log.

Sunday, March 14, 2010

apache2: bad user name ${APACHE_RUN_USER}

I am used to compiling(almost always) the apache 2 server on linux. However, this time when I set up my new ubuntu machine, I decided to try the mighty apt-get/package manager. After installation I tried browsing to http://localhost/ and was quite happy to see the server running.

Sometime later, I felt the need to restart apache. When I tried to restart using the apachectl command, it said command not found. Surely, things were different from how it would have been if I had compiled apache manually.

Doing a "ps -ef | grep apache" showed me the process running as
/usr/sbin/apache2 -k start
Thinking that, probably, thats how we start it in this distro(if installed using apt-get), I tried running the following to restart the webserver,
sudo apache2 -k restart
but I was disappointed to see this message show up,
apache2: bad user name ${APACHE_RUN_USER}
Spending sometime on google and the ubuntu forums and I figured that I was running the wrong command.

Both of these commands(below) worked for me,
sudo apache2ctl -k restart
or
sudo /etc/init.d/apache2 restart
Moreover, apache is not installed where it would be if compiled(it defaults to /usr/local/apache2).

Although the installation was smooth and extremely easy, it still makes me wonder if things(config/folders/etc) would be better if left default?