简体   繁体   中英

How to create/setup cronjob in distributed manner

I want to create/setup cronjob on my production server. (PHP Laravel 5.7)

Let say I've 4 server if cronjob is running on one server and that server stop/crash, cron automatically start from another servers and so on..

All 4 server has there on same/identical cronjob.

All cronjob have same time.

I've googling but couldn't find anything.

Before, you need to run CI/CD in your git platform and to connect it with your project for auto deploying. Then your cronjob contents will be same in 4 servers. GitlabCi deploy on multiple servers https://www.virtualmetric.com/blog/how-to-diagnose-why-your-server-is-down There is explained about how you can check if any server down and how if you can check.

After it, you need to create health checkers between servers. https://gomachado.com/how-to-conduct-a-server-health-check/

Also, you can enable cron service to start automatically when server restart:

sudo systemctl enable cron.service

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