Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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