Skip to content

Instantly share code, notes, and snippets.

@anovsiradj
Created March 26, 2020 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anovsiradj/7aa76a76e058003d449e2ebf0fa77a15 to your computer and use it in GitHub Desktop.
Save anovsiradj/7aa76a76e058003d449e2ebf0fa77a15 to your computer and use it in GitHub Desktop.
<?php
$s = __FILE__;
$l = __DIR__.'/tmp.log';
$p = __DIR__.'/tmp.pid';
$z=$c=$r=null;
if (in_array('bg',$argv)) {
file_put_contents($p,getmypid());
die;
}
if (file_exists($l)) {
$c = fopen($l, 'r');
$z = filesize($l);
$r = fread($c,$z);
fclose($c);
unset($c);
}
$x = exec("/usr/bin/nohup /usr/bin/php ${s} bg > ${f} 2>&1 &");
var_dump($z,$r,$c,$l,$s,$x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment