Skip to content

Instantly share code, notes, and snippets.

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