non blocking php system call - tshark -


i trying start tshark process capturing on interface wlan0 5 minutes. read in other threads tried direct output file this:

$log = "sniff-".date("y-m-d-h-i-s").".txt"; system("sudo tshark -i wlan0 -a duration:300 > /var/www/log".$log); 

i expecting webserver start tshark process , move on. in error log of apache can see normal output of tshark:

running user "root" , group "root". dangerous capturing on wlan0 6 packets captured 

what have change tshark output log file , not interrupt php script? & suffice , if yes, have put it?

solution:

system("sudo tshark -i wlan0 -a duration:300 > /var/www/log".$log." &"); 

by putting & @ end of bash cmd should disconnect running session, try using php threads or php fork run process off parallel process, providing server has relevant settings , modules installed enable this.

system("sudo tshark -i wlan0 -a duration:300 &> /var/www/log".$log.' &'); 

also, adding &> redirect mode, redirect both stdout , stderr streams log file. messages seeing may have come through stderr , may not otherwise appear in log file.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -