Click to See Complete Forum and Search --> : restarting apache?


leetcrew
06-25-2004, 03:17 PM
How to automatically restart apache or run this code every 9 in the morning?



service httpd restart




thanks !! :)

goldbug
06-25-2004, 03:34 PM
man cron
man crontab
man 5 crontab

leetcrew
06-25-2004, 04:08 PM
thanks for a reply.

i created a file and i named it restartApache.sh on Desktop directoy


service httpd restart



after that, i typed crontab ~root/Desktop/restartApache.sh and nothing happened

i tried crontab ~root/Desktop/restartApache.sh and 5 0 * * *
and an error occured

what is the corrent usage with this?

I am very new with this, and i really can't understand the cron manual. sorry :(

LordShryku
06-25-2004, 04:18 PM
You have to edit crontab. It's really nothing more than a text file that is parsed for commands.
crontab -e
Now insert the cron entry
0 9 * * * service httpd restart
Save it, and it should start doing that every morning at 9. You should be passing full path commands to crontab though. I use apachectl, so mine would look like this:
0 9 * * * /usr/local/apache2/bin/apachectl restart

leetcrew
06-25-2004, 04:18 PM
Thanks!! :)
you guys saved my life... hehehe thanks