Pioreactor / pioreactor

Hardware and software for accessible, extensible, and scalable bioreactors. Built on Raspberry Pi.
https://pioreactor.com
MIT License
101 stars 9 forks source link

Race condition - am_i_leader service checks for hostname too soon #489

Closed kellytr closed 7 months ago

kellytr commented 7 months ago

Error: Dependency failed for lighttpd.service - Lighttpd Daemon.

In the command line: sudo systemctl status am_i_leader.service

Output:

`× am_i_leader.service - Gatekeeper service for leader services Loaded: loaded (/lib/systemd/system/am_i_leader.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Mon 2023-12-11 01:25:16 GMT; 3 months 22 days ago Process: 450 ExecStart=/bin/bash -c if [ "$(crudini --get /home/pioreactor/.pioreactor/config.ini cluster.topolog> Main PID: 450 (code=exited, status=1/FAILURE) CPU: 484ms

Dec 11 01:25:12 leader24402 systemd[1]: Starting am_i_leader.service - Gatekeeper service for leader services... Dec 11 01:25:16 leader24402 systemd[1]: am_i_leader.service: Main process exited, code=exited, status=1/FAILURE Dec 11 01:25:16 leader24402 systemd[1]: am_i_leader.service: Failed with result 'exit-code'. Dec 11 01:25:16 leader24402 systemd[1]: Failed to start am_i_leader.service - Gatekeeper service for leader services.`

`pioreactor@leader24402:~ $ cat /lib/systemd/system/am_i_leader.service [Unit] Description=Gatekeeper service for leader services Before=lighttpd.service huey.service create_diskcache.service avahi_aliases.service After=everyboot.service

[Service] Type=oneshot ExecStart=/bin/bash -c 'if [ "$(crudini --get /home/pioreactor/.pioreactor/config.ini cluster.topology leader_hostname)" = "$(hostname)" ]; then exit 0; else exit 1; fi' RemainAfterExit=yes

[Install] WantedBy=multi-user.targetp/lib/systemd/system/am_i_leader.service;ystem/am_i_leader.service; -bash: /lib/systemd/system/am_i_leader.service: Permission denied`