"ad^2" <adsquai...@gmail.com> writes:

>  So, IF: no lock file, create a lock file, execute, delete lock file
> when finished successfully. ElSE: the script is running, exit. Then,
> cron will try again an hour later.
>
> I do not necessarily require a "lock file" just looking for a
> recommendation on a best practice with low complexity to make this
> work.

The third-party ‘fasteners’ library provides an API for locks
<URL:https://pypi.python.org/pypi/fasteners> that you will want to
consider.

Specifically, the interpprocess lock decorators
<URL:https://fasteners.readthedocs.io/en/latest/examples.html#lock-decorator>
seem to be what you want.

-- 
 \            “… Nature … is seen to do all things Herself and through |
  `\         herself of own accord, rid of all gods.” —Titus Lucretius |
_o__)                                                 Carus, c. 40 BCE |
Ben Finney

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to