diff options
| author | Christian Fowler <spider@viovio.com> | 2007-11-29 07:20:57 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2007-11-29 07:20:57 +0000 |
| commit | eb07f1f3af53c69f3bacb9f088b669cbfddcc3cc (patch) | |
| tree | b2503275aa5439150818f7c07ca12f715adb31ae /daemonize | |
| parent | b3c97beb5e23cbaf2df8a6d8d6c03399a025a3fd (diff) | |
| download | util-eb07f1f3af53c69f3bacb9f088b669cbfddcc3cc.tar.gz util-eb07f1f3af53c69f3bacb9f088b669cbfddcc3cc.tar.bz2 util-eb07f1f3af53c69f3bacb9f088b669cbfddcc3cc.zip | |
cleanup daemonize so it auto restarts process properly
Diffstat (limited to 'daemonize')
| -rw-r--r-- | daemonize/daemonize.php | 14 | ||||
| -rwxr-xr-x | daemonize/is_up.sh | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/daemonize/daemonize.php b/daemonize/daemonize.php index 623302b..3711f3b 100644 --- a/daemonize/daemonize.php +++ b/daemonize/daemonize.php @@ -187,17 +187,15 @@ exit(0); # Access functions. function is_alive($pid) { - $result = system( dirname( __FILE__ )."/is_up.sh $pid"); -error_log( $result ); -# to_log("is_alive (${BINDIR}is_up $pid) returned $result"); - return (0 < $result); + $output = array(); + exec( dirname( __FILE__ )."/is_up.sh $pid", $output ); + $result = $output[0]; + to_log("is_alive (".dirname( __FILE__ )."/is_up.sh $pid) returned $result"); + return (0 < $result); } function to_log($string) { - global $DEBUG; - if ($DEBUG) { - error_log(date("r")." - $string\n"); - } + error_log(date("r")." - $string\n"); } function zero_file($pidfile) { diff --git a/daemonize/is_up.sh b/daemonize/is_up.sh index 7a7d1af..f821a78 100755 --- a/daemonize/is_up.sh +++ b/daemonize/is_up.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/bin/bash # Wrapper script because in safe mode PHP gloms all those together. -ps -ef | grep $1 | grep daemonize | wc -l +ps -ef | grep -v $0 | grep $1 | grep daemonize | wc -l |
