Plesk for Linux kb: how-to ABT: Group B
- Plesk for Linux
Websites become temporarily unavailable when applying configuration changes. How to set up Apache restart every day at a certain time?
Plesk does not have a direct functionality to schedule Apache restarts at a particular time of the day.
There are two options to implement it:
- Configure Apache to keep established HTTP connections when applying new configuration:
- configure Apache graceful restart
- set Apache restart interval to 0 in Tools & Settings > Apache Web Server
- install Watchdog extension to monitor Apache
- Create a scheduled task to restart Apache every day:
- log in to Plesk
- set Apache restart interval to
9999in Tools & Settings > Apache Web Server
- go to Tools & Settings > Schedule Tasks and add the task, for example, for CentOS/RHEL/CloudLinux:
Note: for Debian/Ubuntu, the command should be "/usr/sbin/service apache2 restart".
In case the first option is applied, the websites will always stay accessible. However, in certain environments, Apache graceful restart may not be stable. For this reason, Watchdog service monitor should be installed.
A cron job in Ubuntu to restart the apache2 service fails:
Task "service apache2 restart" completed with error in 0 seconds, output:
/bin/sh: 1: service: not found
This work perfectly from the command line.
In addition a domain with webmail disabled keeps popping up in the tempate errors. e.g.
Error: Can not reconfigure web server configurations: Unable to execute httpdmng: [2020-09-20 21:01:01.767] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/apache_control_adapter' '--restart' '--restart-interval' '0' '--http-port' '7080' '--https-port' '7081'] with exit code 
[2020-09-20 21:01:02.860] ERR [panel] Apache config (16006355310.09269600) generation failed: Template_Exception: Can not restart web server:
Can not restart web server:
And then all apache driven sites fail. I cant add a cron job to restart it as I get the error above. This problem is causing MAJOR disruption as all webmail sites go offline.
I have rebuilt the templates, I have removed the templates - they keep coming back
Robert Tucker Hi!, please open a support ticket with us so i can work on this issue https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-
Hello Rbbert Tucker,
You need to provide the full path to service.
/usr/sbin/service apache2 restart
This worked for me
Please sign in to leave a comment.