The old method used to be placing a var in a text file at the start of the script and setting it to zero at the end.
I use this method very successfully although there is probably a more elegant solution.
The script will not run again if the previous running failed in some way but I overcome that with the var I use, epoc time value, a quick check of it's value how long since the last run. If over a given time, (you decide the duration) then run it again.
Keith