Wednesday, January 31, 2007
simple php process monitor
require_once("declare.php");
define("RUNFILEDIR",PREFIX."/runfiles");
function setrunfile()
{
$fp = fopen(RUNFILEDIR."/".getmypid(),"w");
fwrite($fp,time());
fclose($fp);
}
function delrunfile($PID=0)
{
if(!$PID) $PID = getmypid();
unlink(RUNFILEDIR."/$PID");
}
function kill($PID)
{
delrunfile($PID);
exec("kill -KILL $PID");
}
function monitor($maxruntime=999999)
{
foreach(getfiles(RUNFILEDIR) as $f)
if($ts=file_get_contents($f))
{
$etime = time()-$ts;
$PID = preg_replace("#.*\/#","",$f);
info("$PID - $etime");
if($etime>$maxruntime)
kill($PID);
}
}
monitor();
Sunday, January 28, 2007
Temporary failure in name resolution
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
Error: The system could not resolve domain name to ip address.
Solution:
get nameserver ip addreses from the internet provider
open /etc/resolv.conf and add:
nameserver first ip
nameserver second ip
Error: The system could not resolve domain name to ip address.
Solution:
get nameserver ip addreses from the internet provider
open /etc/resolv.conf and add:
nameserver first ip
nameserver second ip
Subscribe to:
Posts (Atom)