Advertisement
MONAROL

Untitled

Jan 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. function LaunchBackgroundProcess($command){ //Запускает команду в фоне
  2.     // Run command Asynchroniously (in a separate thread)
  3.     if(PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows'){
  4.         $command = 'start /MIN "" '. $command;
  5.     } else {
  6.         $command = $command .' /dev/null &';
  7.     }
  8.     $handle = popen($command, 'r');
  9.     if($handle!==false){
  10.         pclose($handle);
  11.         return true;
  12.     } else {
  13.         return false;
  14.     }
  15. }
  16. LaunchBackgroundProcess('php "'.__DIR__.DIRECTORY_SEPARATOR.'script1.php'.'"');
  17. LaunchBackgroundProcess('php "'.__DIR__.DIRECTORY_SEPARATOR.'script2.php'.'"');
  18. LaunchBackgroundProcess('php "'.__DIR__.DIRECTORY_SEPARATOR.'script3.php'.'"');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement