Solved: How do I let a service start at boot on CentOS

All questions related to servers
Post Reply
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Solved: How do I let a service start at boot on CentOS

Post by mister_v »

Hello,

how wow do I let a service start at boot on CentOS.

some start automatically, but some not.

thanks
Last edited by mister_v on Wed Mar 21, 2012 11:31 am, edited 1 time in total.
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: How do I let a service start at boot on CentOS

Post by chris »

You can do this with the builtin chkconfig utility:

Code: Select all

sudo /sbin/chkconfig --list
This command show you all the services and their status on each runlevel.

If you don't see your service in it (mysqld for example?), you can add it.

Code: Select all

sudo /sbin/chkconfig --add mysqld
You also need to set it to ON, in the desired runlevel.
For servers this is mostly runlevel 3.

Code: Select all

sudo /sbin/chkconfig --level 3 mysqld on
Now it should start when the system is rebooted.

For the record the runlevels:
0 - Halt
1 - Single-user text mode
2 - Not used (user-definable)
3 - Full multi-user text mode
4 - Not used (user-definable)
5 - Full multi-user graphical mode (with an X-based login screen)
6 - Reboot
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

Re: How do I let a service start at boot on CentOS

Post by mister_v »

Thanks, just what I needed.
Post Reply