Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Python script that i want to restart if it crashes. So i created a Bash starter script that starts and restarts the Python script in /usr/local/bin/starter

Here's the starter script:

#!/usr/bin/env bash
until myPythonScript; do
    sleep 1s;

This starter script i run @reboot (cronjob).

My Python script is also located in /usr/local/bin/myPythonScript so i can start it just by typing myPythonScript.

Now is my problem that i receive the error message that my /usr/local/bin/starter can't find the command myPythonScript. Does anybody know why and how i could solve this.

share|improve this question

migrated from Sep 18 '13 at 13:40

This question came from our site for system and network administrators.

up vote 2 down vote accepted

Use the full path. If you are using a crontable, cron does not have the same env, including path, that you do.

You might also consider inittab. It can ensure processes are running and restart if they are not present.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .