title: Running Python process with cronjob and checking it is still running every minute
body: <p>I have a Python script that I'd like to run from a cronjob and then check every minute to see if it is still running and if not then start it again.</p>
  
  <p>Cronjob is:</p>
  
  <pre><code>/usr/bin/python2.7 /home/mydir/public_html/myotherdir/script.py
  </code></pre>
  
  <p>there is some info on this but most answers don't really detail the full process clearly, e.g.:</p>
  
  <p><a href="https://stackoverflow.com/questions/9223381/using-cron-job-to-check-if-python-script-is-running">Using cron job to check if python script is running</a></p>
  
  <p>e.g. in that case, it doesn't state how to run the initial process and record the PID. It leaves me with a lot of questions unfortunately.</p>
  
  <p>Therefore, could anyone give me a simple guide to how to do this?</p>
  
  <p>e.g. full shell script required, what command to start the script, and so on.</p>