0

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;
done

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.

1 Answer 1

2

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.

You must log in to answer this question.

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