Skip to main content

/usr/local/cpanel/scripts/restartsrv_httpd doesn't restart Apache

Comments

5 comments

  • cPanelLauren
    What occurs when you run this script through CLI? It definitely performs a graceful restart of apache on my system so I'm not able to replicate this behavior: [root@server ~]# /scripts/restartsrv_httpd Waiting for "httpd" to restart gracefully "waiting for "httpd" to initialize "finished. Service Status httpd (/usr/sbin/httpd -k start) is running as root with PID 2083 (systemd+/proc check method). Startup Log May 03 13:00:05 server.myhostname.us systemd[1]: Starting Apache web server managed by cPanel EasyApache... May 03 13:00:07 server.myhostname.us systemd[1]: Can't open PID file /run/apache2/httpd.pid (yet?) after start: No such file or directory May 03 13:00:07 server.myhostname.us systemd[1]: Started Apache web server managed by cPanel EasyApache. Log Messages [Mon May 04 13:37:27.116322 2020] [mpm_event:notice] [pid 2083:tid 46996269315136] AH00489: Apache/2.4.43 (cPanel) OpenSSL/1.1.1g mod_bwlimited/1.4 configured -- resuming normal operations httpd restarted successfully. [root@server ~]#
    If you want a hard restart of apache: /scripts/restartsrv_httpd --stop
    /scripts/restartsrv_httpd --start
    or alternatively: /scripts/restartsrv_httpd --restart --hard
    After a hard restart: # apachectl status Apache Server Status for localhost (via 127.0.0.1) Server Version: Apache/2.4.43 (cPanel) OpenSSL/1.1.1g mod_bwlimited/1.4 Server MPM: event Server Built: Apr 27 2020 15:46:38 -------------------------------------------------------------------------- Current Time: Monday, 04-May-2020 14:40:58 CDT Restart Time: Monday, 04-May-2020 14:40:52 CDT
    The help information in the script explains what restart is performed by default: [root@server ~]# /scripts/restartsrv_httpd --help /scripts/restartsrv_httpd - manage service httpd Usage: /scripts/restartsrv_httpd [ACTION] [OPTIONS] The default action is to restart the httpd service. The script returns 0 in case of success, and a positive integer in case of an error. Note: Error output is displayed on STDERR. Available actions: --help Display this help message. --restart Restart the service (via a soft restart, if available). [default action] --hard Perform a hard restart (skip the soft restart). This is the default action if soft restarts aren't supported for the service. --graceful Attempt a graceful restart of the service, if the service supports this action. --reload Reload the service, if the service supports this action. --stop Stop the service. --status Return the current service status via the exit code. Available options: --notconfigured-ok Services that are not configured will exit with a non-fatal return code (this does not mean they'll carry out the requested action, ie start) Sample usages: # Restart the service (using a "soft" or "graceful" restart when supported) > /scripts/restartsrv_httpd > /scripts/restartsrv_httpd --restart # Stop the service. > /scripts/restartsrv_httpd --stop # Perform a hard restart. > /scripts/restartsrv_httpd --restart --hard
    0
  • PeteS
    It appears to restart, giving the output expected as you post (with variations appropriate to my server), but when I check the uptime/PID, nothing has changed. What gets called in WHM? WHM and systemctl restart httpd.service work as expected (new PID and uptime). -Pete
    0
  • cPanelLauren
    It's a graceful restart, or reload the PID wouldn't change. You're looking for a hard restart. Try the instructions for that which I provided I believe you'll see the difference.
    0
  • PeteS
    Ah, so it is! Thanks for clarifying. Systemctl restart defaults to a hard restart. Am I correct that WHM restarts apache with --hard since there is no option for graceful (as there is with reboot)? You can mark SOLVED after your response. Thanks, again! -Pete
    0
  • cPanelLauren
    Yep it does perform a hard restart instead of a reload! I'll go ahead and mark this as resolved for you :)
    0

Please sign in to leave a comment.