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

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


Cron is a scheduler, it's good if you want your script to run every 5 minutes, or every 3rd Wednesday etc, but for an arbitrary restart upon completion which could (I presume, you don't indicate what the Python script is doing, how long it takes or if the time to completion is variable etc) be essentially random it's not the best choice.

You can either insert some logic into the script directly, or you could simply wrap the script with some Shell Scripting logic as per @user3439968's answer, my version is essentially the same, but I've shown it a little more verbose with options for keeping an eye on the restarts etc. You can type this into pretty much any command line shell, simplest to just open Terminal and type it straight into it

while true
do
    /path/to/script.py
    sleep 60
    date >> /path/to/logfile.txt
    echo "The script ended, and I restarted it after 60 seconds" >> /path/to/logfile.txt
done

In the example above the restart isn't immediate but waits 60 seconds, then appends the current date and a message to a log file on each restart. You can put any control code after the initial run of the Python script and the done line, even get it to mail you that it's restarted etc.

Because you don't specify what "true" is, it can never be false, so essentially everything between do and done is looped over and over until it receives a suitable interrupt signal like a CTRL-c or a kill -9 PID type command from another command line session.