I have a web server where i run a python script on detached mode like this:
<?php shell_exec("sudo -u root -S python /var/www/html/test_charge_new.py > /dev/null 2>/dev/null &"); ?>
This Script is expecting 'Ctrl + C' (^C) to stop. And the script ends properly with this approach.
I have a button on one of the pages to stop the detached script on my web server running these commands:
shell_exec('ps a | grep test_charge_new.py | grep -v grep', $otherProcessInfo);
$otherProcessInfo = array_filter(explode(' ', $otherProcessInfo[0]));
$otherProcessId = $otherProcessInfo[0];
shell_exec("kill $otherProcessId");
But it wont work. There is a way to send ^C to the Script?
Thanks in advice, Ricardo
Aucun commentaire:
Enregistrer un commentaire