简体   繁体   中英

Scheduling task execution based on previous execution

I want to execute my utility (to do some cleanup tasks) continuously. Next execution should start as soon as the current one finished successfully.

I can't use the Java scheduler or Crontab as I don't know the execution interval in advance. One option is updating the database after every successful execution and inspecting it before each execution.

Is there any better option to do this?

My utility is written in Java.

Perhaps your can install run-one utility in your system.

run-one is a wrapper script that runs no more than one unique instance of some command with a unique set of arguments.

This is often useful with cronjobs, when you want no more than one copy running at a time.

More information on how to use run-one utility here . It can be combined with cron:

*/60 * * * *   run-one your-program arg1 arg2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM