Hi, Recently my Apache web server down for unknown reason. Luckily, I'm online at that time to start Apache. When this problem occured more than two times, I tried searching internet and found the way to automatic start Apache when it died. - Create a .sh file, e.g /usr/local/startapache.sh with this contents: #!/bin/sh pgrep httpd if [ $? -ne 0 ]; then service httpd start fi Code (markup): - Chmod it to 0777 - Set a cron job every minute with that file crontab -e Code (markup): Enter * * * * * /usr/local/startapache.sh Code (markup): Press Esc -> :x -> enter Restart crond service crond restart Code (markup): And done! Hope this help
Hey you guys, I just found a simpler way: - Set cron job every minute with this command: pgrep httpd || service httpd start Code (markup): So, your crontab entry will look like this: * * * * * pgrep httpd || service httpd start Code (markup): Very simple