Home > Linux > Linux – 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
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: