• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

set cron job for automatic email sending

L

larvus

Guest
hi

i want to create php script as a cron job under plesk .

my script is servercheck.php , this script will check the website , if the server down it will will send a mail .



<?php
function pingDomain($domain){
$starttime = microtime(true);
$file = fsockopen ($domain, 80, $errno, $errstr, 10);
$stoptime = microtime(true);
$status = 0;
if (!$file) $status = -1; // Site is down
else {
fclose($file);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);
}
return $status;
}

$domainbase="www.example.com";
$status = pingDomain($domainbase);
if ($status == -1){
$headers = "From: [email protected]\r\n";
mail('[email protected]','Server Down','Anantix Server Down');

}
?>
i tried

Server->root->Scheduled tasks

Min H DM M DW Command
5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/php /var/www/vhosts/bio-world.com/httpdocs/test/php/servercheck.php

not working

pls help to setup this php script as a cron job.
 
Back
Top