Menu
 
 
Free Course: Do you like reading White Papers, Magazine, eBooks, Video Tutorials? Just enter your email below to receive...


How to auto-start services on boot in Linux?

 

Linux

 

Below instructions will help you in configuring auto-start services on boot. I have taken 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

 

[root@Chandan init.d]# ls -ltr httpd

-rwxr-xr-x. 1 root root 3371 Jan 6 08:56 httpd

[root@Chandan init.d]#

 

  •   Add script to start on boot using chkconfig utility

chkconfig –add httpd

chkconfig httpd on

 

[root@Chandan init.d]# chkconfig --add httpd

[root@Chandan init.d]# chkconfig httpd on

 

  • Confirm script is added using chkconfig utility

 

[root@Chandan init.d]# chkconfig --list httpd

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

[root@Chandan init.d]#

 

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

You can disable auto-start service using chkconfig utility

chkconfig httpd off

chkconfig –del httpd

Done!

back to top