From a0198dc43526022bd5ab3e768ee4ad518982c5df Mon Sep 17 00:00:00 2001 From: TheTroll Date: Fri, 2 Apr 2010 15:59:49 +0200 Subject: Improved status reporting --- bin/utils.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bin/utils.php') diff --git a/bin/utils.php b/bin/utils.php index 2324032..a1489c8 100644 --- a/bin/utils.php +++ b/bin/utils.php @@ -182,4 +182,23 @@ if (!function_exists('json_encode')) } } +function is_pid_running($pidfile) +{ + // Check file + if (!file_exists($pidfile)) + return 0; + + // Check if pid has a pid inside + exec('cat ' .$pidfile, $output); + if (!is_numeric($output[0])) + return 0; + + // Check if pid is running + exec('ps `cat ' .$pidfile .'`', $output); + if(count($output) < 2) + return 0; + + return 1; +} + ?> -- cgit v1.2.3