Cron to Restart Apache Every Hour?

Discussion in 'Apache' started by mafrussian, Aug 10, 2007.

  1. #1
    What do I need to type into shell to get this? I use WHM and Cpanel.
    WHM 10.8.0 cPanel 10.9.1-S14304
    RedHat Enterprise 4 i686 - WHM X v3.1.0 Is my server info
     
    mafrussian, Aug 10, 2007 IP
  2. melon

    melon Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why on earth would you want to restart apache every hour?
    Anyway, apache has an apachectl command, and you can run 'apachectl graceful' to do a graceful restart (existing threads finish before restart). But once again, it's weird why you want to restart it.
     
    melon, Aug 11, 2007 IP
  3. Nefarious

    Nefarious Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You want to open crontab by typing in:
    crontab -e
    Code (markup):
    You need to know the location of your httpd. here is what will go in the crontab:
    0 * * * * /etc/rc.d/init.d/httpd restart
    Code (markup):
    replace the /etc/rc.d/init.d/httpd to your path
     
    Nefarious, Aug 14, 2007 IP