Skip to main content

Making sure a daemon runs on server reboot

Posted in

Another piece of code that I always seem to have to look up when I need it... The command for getting mysqld (or another daemon) to start up when the server reboots is chkconfig, used as follows:

chkconfig mysqld on

If you just enter chckconfig, it will output a list of the daemons and their current status:

 anacron         0:off   1:off   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 dc_client       0:off   1:off   2:off   3:off   4:off   5:off   6:off dc_server       0:off   1:off   2:off   3:off   4:off   5:off   6:off httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off ip6tables       0:off   1:off   2:off   3:off   4:off   5:off   6:off iptables        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 messagebus      0:off   1:off   2:on    3:on    4:on    5:on    6:off mysqld          0:off   1:off   2:on    3:on    4:on    5:on    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 rdisc           0:off   1:off   2:off   3:off   4:off   5:off   6:off restorecond     0:off   1:off   2:off   3:off   4:off   5:off   6:off rsyslog         0:off   1:off   2:on    3:on    4:on    5:on    6:off saslauthd       0:off   1:off   2:off   3:off   4:off   5:off   6:off sendmail        0:off   1:off   2:off   3:off   4:off   5:off   6:off sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off udev-post       0:off   1:on    2:on    3:on    4:on    5:on    6:off

The columns indexed by number indicate the settings for specific runlevels; it appears that when you've turned a daemon on, it sets runlevels 1-4 to the on state.