Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    53
    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:
    16,352
    Likes Received:
    402
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. jameshurrell

    jameshurrell Member

    Joined:
    Feb 17, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    53
    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,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What was the new error message it returned?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice