LinuxLinux – running scripts on boot

Linux – running scripts on boot

In Linux, you can configure some scripts and daemons to start running at system boot.

If you have a custom script, make sure that it is executable and the permissions are set correctly.

I am on CentOS 6.5

I am going to use the ntp daemon as an example – Network Time Protocol that syncs the local servers time from the internet

# install the ntp package
sudo yum install ntp

# set ntpd to run on startup 
chkconfig ntpd on

# example of some other services apache web server, mysql, to run on boot
chkconfig httpd on
chkconfig mysqld on

To see which scripts will run at boot, use the command

chkconfig --list

To see data for only mysqld use

chkconfig --list mysqld

The numbers you see in the –list command (¬†0:off 1:off 2:on 3:on 4:on 5:on 6:off ) are system run levels

You can find your current systems run level by using the command


make sure that the script you want to run has the runlevel = on in chkconfig

example, my system run level is N 5 and this is what i have for ntpd ( 5 : on )

ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Categories: Linux Tags: , ,


No Comments Yet. Be the first?

Post a comment

Your email address will not be published. Required fields are marked *