Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Created May 22, 2017 03:23
Show Gist options
  • Save khanhtran3005/52926182931a81efc07ea2919ebb0470 to your computer and use it in GitHub Desktop.
Save khanhtran3005/52926182931a81efc07ea2919ebb0470 to your computer and use it in GitHub Desktop.
Check a process whether running for not using PHP
function processExists($processName) {
    $exists= false;
    exec("ps -aux | grep -i $processName | grep -v grep | grep -v /bin/sh", $pids);
    if (count($pids) > 1) {
        $exists = true;
    }
    return $exists;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment