I have PHP script running right now with root permissions that starts from the following lines:
set_time_limit(0);
ini_set('log_errors', 1);
ini_set('error_log', "log.txt");
It was accidentally started by web management panel from root user as cron task. Right now script is writing warnings caused by something like this while(!feof($file_handle))
to file, increasing its size by 10 megabytes per second.
I don't have console root access to website, server owner is unavailable due to time difference. I only can run commands as root, once per minute, using cron from web panel (no output as you understand).
How can I stop my script from wasting system resources? Right now I delete file every minute with same cron script, so server can continue working. My linux knowledge is not enough to solve this problem without help, unfortunately.
Best Answer
If the command was executed as something like
php /path/to/script.php
, then you could do something likeor:
where
<pid>
is the process id of the process running that you want to kill.You can also get the pid and executed line of the process with:
NOTE: the argument to
pkill
andpgrep
should be something you know is in the commandline. The path is usefull if you called it that way, otherwise just use the name.