• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

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