How to run a cron job each time the previous execution has finished

cronpythonterminal

I would like to run a Python script each time it finishes and I think I can do this with cron but I am not sure how to do it.

The idea is each time the Python scripts ends, it will have to run again and again.

I have searched for answers here but I can't find something similar to this.

Best Answer

In terminal:

while :; do ./script_name; done

or

while :; do python programm.py; done

If you want add some sleep time before run program again use 'sleep' command:

For example:

while :; do python programm.py; sleep 90; done

in this example cycle will sleep 90 second before run again you program