Kill process in Php - sudo
Posted: Sat Nov 14, 2009 7:47 am
Hi ,
I am trying to kill a process thru php.
<?php
$pid=system("pidof myprocess");
echo "\n$pid";
exec("echo my pid is $pid", $out);
echo "restart process $pid";
exec("kill -6 $pid",$out);
var_dump($out);
?>
I am grabbing the process id successfully in $pid, and passing it to exec, but that doesn't work. I think its a permission thing, as all the above works, except the kill statement, which I believe its SELinux that gives me permission denial to execute the command via php.
I am on the sudoer list- how can I do this. I don't want a complicated function - Its just to allow my secretary to restart some batch jobs via a simple web page. She wouldn't know what a linux terminal is if her life depended on it.
Cheers,
C.
I am trying to kill a process thru php.
<?php
$pid=system("pidof myprocess");
echo "\n$pid";
exec("echo my pid is $pid", $out);
echo "restart process $pid";
exec("kill -6 $pid",$out);
var_dump($out);
?>
I am grabbing the process id successfully in $pid, and passing it to exec, but that doesn't work. I think its a permission thing, as all the above works, except the kill statement, which I believe its SELinux that gives me permission denial to execute the command via php.
I am on the sudoer list- how can I do this. I don't want a complicated function - Its just to allow my secretary to restart some batch jobs via a simple web page. She wouldn't know what a linux terminal is if her life depended on it.
Cheers,
C.