• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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