My crontab had the command:
Quote:
50 08 * * 1-5 /home/MY_SCRIPT.py /home/arguments 2> /dev/null
59 23 * * 1-5 killall MY_SCRIPT.py
|
Which worked perfectly fine, but when I used to do
Code:
ps aux | grep SCRIPT
it showed
Quote:
myuser 13898 0.0 0.0 4444 648 ? Ss 08:50 0:00 /bin/sh -c /home/MY_SCRIPT.py /home/arguments 2> /dev/null
myuser 13900 0.0 0.0 25268 7384 ? S 08:50 0:00 /usr/bin/python /home/MY_SCRIPT.py /home/arguments
|
- Why are 2 processes been shown
And the killall command also used to work fine.
I made a change to my script and in order to get the new behaviour, I had to kill the currently running scripts and I used
After that I used the same command (as in crontab)
Code:
/home/MY_SCRIPT.py /home/arguments 2> /dev/null
- But now after restrating the script, it showed only 1 process (which makes sense)
Everything looks good till here, but this time the killall MY_SCRIPT in the cronjob didnt work, it said could not find pid. And the script kept on running until I had to manually kill it.
Need to find out the reason for this behaviour:
- Why 2 processes from cronjob
- Is there something wrong the way I restrated the script
- How do I make sure that next time I restart the script, the cron should kill it for sure