Cron Job Command for restart httpd Service ?

alemmsm

Verified User
Joined
Nov 9, 2017
Messages
43
Cron Job Command for restart httpd Service ?

Similar to the following command :
:2222/CMD_SERVICE?action=restart&service=httpd
 
Hello,

Add into cron the command with your desirable frequency:

Code:
echo "action=httpd&value=restart" >> /usr/local/directadmin/data/task.queue

and Apache will be restarted within 1 minute by directadmin.
 
Look at the picture


444444.jpg

I created a file /home/admin/df201rreeee.php
And put in the file

echo "action=httpd&value=restart" >> /usr/local/directadmin/data/task.queue


But it will not be restart httpd Service again every minute
 
Last edited:
That's not a command - that's a php file.

Check out the previous answer from Alex. Instead of "/home/admin/df201rreeee.php" write "echo "action=httpd&value=restart" >> /usr/local/directadmin/data/task.queue"

Why you want to restart it every 1 minute?
 
I created a file /home/admin/df201rreeee.php
And put in the file

That's not PHP syntax, it's a bash/shell.

But it will not be restart httpd Service again every minute

Only user root and diradmin can write into the file due to the directory permissions.

Code:
# ls -lad /usr/local/directadmin/data/
drwx--x--x 8 diradmin diradmin 32K Jan  8 06:02 /usr/local/directadmin/data/

If you don't have root permissions on the server you need to use API: https://www.directadmin.com/features.php?id=759
 
If I want to run when is load average on 5 minutes what do I do


#!/bin/sh
check=`cat /proc/loadavg | sed 's/\./ /' | awk '{print $1}'`
if [ $check -gt 10 ] //10 is load average on 5 minutes
then
httpd restart

fi


It does not work

*/5 * * * * root /usr/local/auto/restart.sh >/dev/null 2>&1
 
Last edited:
And what is

Code:
httpd restart
?

Is it a function call from your script? Or typo?
 
service httpd restart WHEN Warning: The system load average is 155.83


Auto reboot script with up loaded server
I want to be upgraded when it is loaded Apache
 
I have just below code in Crone Command:

Code:
echo "action=httpd&value=restart" >> /usr/local/directadmin/data/task.queue

And email notice is:

Code:
/bin/sh: 1: cannot create /usr/local/directadmin/data/task.queue: Permission denied
 
Back
Top