Starting a Service At Boot With Linux Centos or Red Hat

Starting a Service at Boot With Centos or Red Hat

The chkconfig command will allow you to start a service upon a boot or reboot. In most cases, it is very necessary to set this up properly so that everything will work as you want it to after a reboot. If it is not, services like Apache and mySQL will not start unless they are not instructed to do so.

With that said, the following simple set of steps can be used to start a service automatically when the Linux VPS or dedicated box is booted. The example will show how to add the service for checking, list its settings, make it start at boot time and remove it from starting at boot time.


To add the service to chkconfig,

 root# /sbin/chkconfig --add monit

To see if the service was added to chkconfig,

 root# /sbin/chkconfig --list monit monit           
0:off   1:off   2:off   3:off   4:off   5:off   6:off

To add the service to start upon boot,

 root# /sbin/chkconfig monit on

To check that the service was changed with chkconfig,

 root# /sbin/chkconfig --list monit monit           
0:off   1:off   2:on    3:on    4:on    5:on    6:off

Note: The values have for 2,3,4 and 5 are now on and this service will not run automatically upon a reboot. Those run levels of 2,3,4 and 5 are the relevant ones for the matter at at hand.

To remove the service from starting upon boot,

 root# /sbin/chkconfig monit off