Aslında php ve bash bir arada bulunuyor:
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));
I 2>&1 & echo $! orada ne anlamıyorum?
2>&1 redirects stderr to stdout ve $! "Expands to the process ID of the most recently executed background (asynchronous) command".
Yani, burada ne olur:
$cmd stdout iki göndermek $outputfile. Bunu olmadıysa 2>&1, dosyadaki stderr çıktı okumak mümkün olmaz.& anlamına takip eden işlem runs in the background.$cmd sonuna ($! yoluyla elde edilmiştir) PID'ini ekleme $pidfile.