Ejemplo n.º 1
0
 public static function check_for_pid($pid)
 {
     $OS = Sync::getOS();
     if ($OS == 2) {
         $processes = explode("\n", shell_exec("tasklist.exe"));
         foreach ($processes as $key => $value) {
             if (empty($value) != '1' && strpos("Image Name", $value) === 0 || empty($value) != '1' && strpos("===", $value) === 0) {
                 continue;
             }
             $matches = false;
             preg_match("/(.*?)\\s+(\\d+).*\$/", $value, $matches);
             if (isset($matches[2]) && ($pid = $matches[2])) {
                 return true;
             }
         }
     } else {
         return file_exists("/proc/" . $pid);
     }
 }