0

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.

Ram Kumar
  • 11
  • 3

1 Answers1

-2

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
Tural Rzaxanov
  • 783
  • 1
  • 7
  • 16
  • Please post solutions inside your answer, do not use links to 3rd party sites. If those links are unavailable (for whatever reason) this answer is of no real use – brombeer Nov 17 '22 at 07:48
  • 1
    "Then your cronjob contents will be same in 4 servers" - that would mean that all four servers would run them? Sounds like a pretty bad idea if for example these cronjobs send out mails – Nico Haase Nov 17 '22 at 09:35
  • @NicoHaase it is not my idea. Owner question wants this. Do you need condemn only? – Tural Rzaxanov Nov 17 '22 at 10:06
  • Feel free to add all clarification to your answer by editing it. I don't see how having CI/CD has any connection to the problem, nor would `sudo systemctl enable cron.service` help to move a cronjob from a crashing server to another – Nico Haase Nov 17 '22 at 10:11
  • Finally, all explanation should be given **in your answer** without the need to click on any external link – Nico Haase Nov 17 '22 at 10:11