The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restart Apache correctly from script file (via cron)

Discussion in 'EasyApache' started by jameshurrell, Aug 15, 2011.

  1. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    1
    I am in the process of writing a script file that downloads a .GZ file from the web and then unzips it to a specific folder and overwrites the existing file of the same name. I then need to restart Apache so that the contents of the new version of the file are taken into account. This script will then be run from a cron job.

    I'm testing the script by running it manually at the moment, but having trouble getting Apache to restart...

    Searching this forum brings up this script as the one to use to do restart Apache cleanly:

    /scripts/restartsrv_apache

    However, when I run this from an SSH session (bash /scripts/restartsrv_apache) I get:

    restartsrv_apache: line 7: /usr/local/cpanel/scripts/restartsrv_httpd,: No such file or directory
    restartsrv_apache: line 7: exec: /usr/local/cpanel/scripts/restartsrv_httpd,: cannot execute: No such file or directory


    I checked /usr/local/cpanel/scripts/ and sure enough, there is a file called restartsrv_httpd there....

    What's going on? Any ideas why it won't run? What am i doing wrong? :confused:

    Thanks.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,455
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    1
    Thank you. That's intersting... I had already found that page and tried:

    /usr/local/cpanel/scripts/restartsrv httpd

    That didn't work either - it just resulted in a new error message.

    Now, however, in a new SSH session that works fine...!!! Must be me....:confused:
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What was the new error message it returned?
     
Loading...

Share This Page