[Tutor] Lock File Usage

ad^2 adsquaired at gmail.com
Mon Jan 30 09:45:24 EST 2017


Hello all,

I have more more todo on a script I just finished. Prevent it from
executing again if the process is running from the last job. Can't go to
production without it.

Ex. it runs in cron every hour to process batches of large size files.
Potentially the processing could take longer than one hour depending on the
file submissions.

 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. I
was hoping not to use the subprocess module to simulate what could be done
in Bash. But, if that's the answer then so be it.

Thanks,

Ad^2


More information about the Tutor mailing list