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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/600219

Title:
  faxgetty segfault

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to