title: Cronjob command starts 2 processes, for 1 python script
body: <p>My crontab had the command:</p>
  
  <blockquote>
    <p>50 08 * * 1-5 /home/MY_SCRIPT.py /home/arguments 2> /dev/null</p>
    
    <p>59 23 * * 1-5 killall MY_SCRIPT.py </p>
  </blockquote>
  
  <p>Which worked perfectly fine, but when I used to do </p>
  
  <blockquote>
    <p>ps aux | grep SCRIPT</p>
  </blockquote>
  
  <p>It showed:</p>
  
  <blockquote>
    <p>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</p>
    
    <p>myuser 13900 0.0 0.0 25268 7384 ? S 08:50 0:00 /usr/bin/python /home/MY_SCRIPT.py /home/arguments </p>
  </blockquote>
  
  <ul>
  <li>Why are 2 processes been shown?
  And the killall command also used to work fine.</li>
  </ul>
  
  <p>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 </p>
  
  <blockquote>
    <p>kill 13898 13900</p>
  </blockquote>
  
  <p>After that I used the same command (as in crontab)</p>
  
  <blockquote>
    <p>/home/MY_SCRIPT.py /home/arguments 2> /dev/null</p>
  </blockquote>
  
  <ul>
  <li>But now after restarting the script, it showed only 1 process (which makes sense)</li>
  </ul>
  
  <p>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.</p>
  
  <p>Need to find out the reason for this behaviour:</p>
  
  <ol>
  <li>Why 2 processes from cronjob</li>
  <li>Is there something wrong the way I restrated the script</li>
  <li>How do I make sure that next time I restart the script, the cron should kill it for sure</li>
  </ol>
  
  <p>OS:Linux Ubuntu</p>