linux - services start at boot

The goal of this document is to show how to activate a service at boot

Verify the Service

I like to verify what the service is named and what it's current behavior is.

For this document I will use the MySQL service (mysqld).

  • Let's see the services:

rootatgis03v5wiki -# chkconfig --list
ConsoleKit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
NetworkManagerDispatcher 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
.
.
.
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
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
nasd 0:off 1:off 2:off 3:off 4:off 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
.
.
.

We can see that mysqld is off at every boot level

  • On this system we only use the command line interface which is boot level 3 but let's also activate it for xwindows (boot level 5)

rootatgis03v5wiki -# chkconfig --level 35 mysqld on;

But how do we know it worked?

rootatgis03v5wiki -# chkconfig --list
.
.
.
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
.
.
.