Hi,

I have created a systemd script along with the timer which runs once every
three hours. I have the same settings across node1 and node2 which are
hosted behind the load balancer. The reason setting behind LB is to make
sure we avoid a single point of failure scenarios. I have a specific issue
here both the systemd tasks are doing the same job which will result in
*duplication*. Is there a way to set it in such a way that node1 systemd
tasks should run all the time and if node1 goes down in an event of failure
then node2 systemd service will trigger the tasks.  Can systemd service on
node1 talk to node2 and vice versa? Please suggest.

*Node1*
[root@devplace-dev-vm1]#cat /etc/systemd/system/checkeverythreehours.service
[Unit]
Description=checkeverythreehours
[Service]
Type=simple
User=deployuser
ExecStart=/bin/bash /var/www/html/dsc/devplace/externaldrupalcron.sh
[root@devplace-dev-vm1]#cat /etc/systemd/system/checkeverythreehours.timer
[Unit]
Description=A timer that runs once in every three hours
Requires=checkeverythreehours.service

[Timer]
Unit=checkeverythreehours.service
AccuracySec=1us
OnUnitActiveSec=10800
Persistent=true

[Install]
WantedBy=timers.target
[root@devplace-dev-vm1]#

*Node2*
[root@devplace-dev-vm2]#cat /etc/systemd/system/checkeverythreehours.service
[Unit]
Description=checkeverythreehours
[Service]
Type=simple
User=deployuser
ExecStart=/bin/bash /var/www/html/dsc/devplace/externaldrupalcron.sh
[root@devplace-dev-vm2]#cat /etc/systemd/system/checkeverythreehours.timer
[Unit]
Description=A timer that runs once in every three hours
Requires=checkeverythreehours.service

[Timer]
Unit=checkeverythreehours.service
AccuracySec=1us
OnUnitActiveSec=10800
Persistent=true

[Install]
WantedBy=timers.target
[root@devplace-dev-vm2]#

Thanks in advance.

Best Regards,

Kaushal

Reply via email to