Startup Services – Centos 6.5

by / Friday, 11 July 2014 / Published in Sys Admin

In today’s tutorial we will be looking at startup services, identifying which have been set to start on boot and how to enable on boot startup. This is quite important because by default a service isn’t set to start on boot. It can be quite a headache if your server goes down and lets say for example apache wasn’t set to start. Your server will startup, but your webserver won’t be switched on.

Fear not, this post will sort that out in a jiffy.

What are Linux Runlevels?

A runlevel refers to the mode in which a service is running in.

Run Level Mode Action
0 Halt Shuts down system
1 Single-User Mode Does not configure network interfaces, start daemons, or allow non-root logins
2 Multi-User Mode Does not configure network interfaces or start daemons.
3 Multi-User Mode with Networking Starts the system normally.
4 Undefined Not used/User-definable
5 X11 As runlevel 3 + display manager(X)
6 Reboot Reboots the system

In order to see which services are currently running in which runlevel we will use the chkconfig tool. To perform a list of all services and their runlevels we do the following;

Our output may differ depending on the services you have installed. But for the purposes of this tutorial we will be looking at the apache service, our webservers service is called httpd and as you can see on line 9 this service isn’t set to run on boot. So lets change it.

Great! We have just set the httpd “Apache” service to start automatically when the server starts. Later on we will be looking at writing startup scripts which will define which service starts in which sequence. Very important if you have a website which requires a database, the database needs to start first then the webserver.

 

Until next time.

 

TOP