If you are rebooting your Linux server on a regular basis then probably you want to configure your services in such a way that they get restarted on reboot. By doing this you don’t have to start them manually each time you reboot.

I have taken the example of Apache service with httpd script file name.

  • Become as root user on your Linux server
  • Create or copy your script under /etc/init.d
[[email protected] init.d]# ls -ltr httpd
-rwxr-xr-x. 1 root root 3371 Jan 6 08:56 httpd
[[email protected] init.d]#
  • Add script to start on boot using chkconfig utility
[[email protected] init.d]# chkconfig --add httpd
[[email protected] init.d]# chkconfig httpd on
  • Confirm script is added using chkconfig utility
[[email protected] init.d]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[email protected] init.d]#

That’s all! httpd script will be called to start services on Linux boot.

In case you need to disable auto-start service then you can use the following commands

chkconfig httpd off
chkconfig –del httpd

This has helped me and I hope it’s beneficial to you.

Reader Interactions

Comments

  1. Instead of chkconfig –del httpd, we need to do chkconfig –-del httpd (Please check chkconfig sysntax)

Comments

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