diff options
author | TheTroll <trolldev@gmail.com> | 2010-04-02 15:59:49 +0200 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-04-02 15:59:49 +0200 |
commit | a0198dc43526022bd5ab3e768ee4ad518982c5df (patch) | |
tree | 3b46d8213532e603651c506beb6fabb2787c866a /bin/utils.php | |
parent | 45938e824d755cb4beddca176c81e692029d981e (diff) | |
download | istreamdev-a0198dc43526022bd5ab3e768ee4ad518982c5df.tar.gz istreamdev-a0198dc43526022bd5ab3e768ee4ad518982c5df.tar.bz2 |
Improved status reporting
Diffstat (limited to 'bin/utils.php')
-rw-r--r-- | bin/utils.php | 19 |
1 files changed, 19 insertions, 0 deletions
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; +} + ?> |