Problem scenario
You want the Apache web service to start automatically after a Linux server is rebooted. You want it to start automatically when you turn on a Linux server (after being off completely). On Linux CentOS you have this entry in /etc/crontab:
@reboot root apachectl start
You notice that on reboots (warm or soft) it works. But when you turn on your server after it has been off, this entry does not start Apache web server. You tried creating a Bash script (making it executable too) in /etc/init.d with this command: "apachectl start". Despite these things, the Apache web service does not reliably start when you reboot or turn the server on.
How do you get Apache web server to automatically start when the CentOS server is turned on (after a cold or hard reboot)?
Possible Solution #1
As root, issue this command: chkconfig httpd on
This solution will start the Apache web service automatically when either of the following two things occur: one, when the server is turned on from being off completely (hard or cold reboot). Two, when the server was warmly (aka softly) rebooted.
Possible Solution #2
It may be preferable to use "sudo chkconfig httpd on" without being root. Test it to see if it works on your system.