简体   繁体   中英

How can I ensure cron job runs only on one host at any time

I have a django management command run as a cron job and it is set on multiple hosts to run at the same time. What is the best way to ensure that cron job runs on only one host at any time? One approach is to use db locks as the cron job updates a MySQL db but I am sure there are better(django or pythonic) approaches to achieve what I am looking for

简单方法:-在需要的时间(例如两分钟)之前启动cron-强制同步时间(使用ntp或ntpdate)(可选的偏执模式)-等待预期时间,运行作业

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