I did this in PHP and run it as root in /etc/crontab
PHP: <?php /** * Comprueba que faxgetty se ejecuta y en caso contrario reinicia el demonio * Check if faxgetty runs and if not restart the service * */
$proceso='faxgetty'; //process $busqueda='faxgett'; //find process $comando="ps -Al -cmd| grep $busqueda"; //command !!! $fecha=date("d-m-Y h:i");
$resultado=exec($comando); //execute command
### find $busqueda in $resultado ### if(stripos($resultado,$proceso)) { echo "Proceso encontrado - sin acciones"; //OK } else { echo "Proceso no encontrado reinicinado server hylafax"; exec("/etc/init.d/hylafax restart"); } ?>
Edit /etc/crontab and add:
#runfaxgetty .php runs every hour 01 * * * * root php -f /runfaxgetty.php
I did this in PHP and run it as root in /etc/crontab
PHP:
<?php
/**
* Comprueba que faxgetty se ejecuta y en caso contrario reinicia el demonio
* Check if faxgetty runs and if not restart the service
*
*/
$proceso= 'faxgetty' ; //process 'faxgett' ; //find process
$busqueda=
$comando="ps -Al -cmd| grep $busqueda"; //command !!!
$fecha=date("d-m-Y h:i");
$resultado= exec($comando) ; //execute command
### find $busqueda in $resultado ### $resultado, $proceso) ) "/etc/init. d/hylafax restart");
if(stripos(
{
echo "Proceso encontrado - sin acciones"; //OK
}
else
{
echo "Proceso no encontrado reinicinado server hylafax";
exec(
}
?>
Edit /etc/crontab and add:
#runfaxgetty .php runs every hour
01 * * * * root php -f /runfaxgetty.php