summaryrefslogtreecommitdiff
path: root/bin/utils.php
diff options
context:
space:
mode:
Diffstat (limited to 'bin/utils.php')
-rw-r--r--bin/utils.php19
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;
+}
+
?>