I’m wondering if it’s safe to run release_autorun.sh as a service with a unit file as follows:
[Unit]
Description=Ceremony Client Go App Service
[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=/root/ceremonyclient/node
ExecStart=/.../ceremonyclient/node/release_autorun.sh
[Install]
WantedBy=multi-user.target
Specifically, since the release_autorun.sh script doesn’t set -e, can it happen that systemd thinks the service is running, but in fact it keeps crashing?
Would it be safer to do something like this (haven’t tested it):
It might maybe be too strict, causing the service to stop entirely on transient errors (e.g., temporary network issues during fetch) ?
I don’t think this is an issue, because the Restart=always setting will make systemd restart the script if it fails.
(In order to make sure the service will be restarted after any number of failures, StartLimitIntervalSec=0 should be set on the unit, but in practice RestartSec=5 in combination with the default values for StartLimitIntervalSec and StartLimitBurst achieves the same thing.)
Many users have been running the release_autorun.sh this way for months now, and no issue was reported.
I think it should work fine most of the time, but there is a non-zero chance that systemctl status quilibrium will say the service is running, but in fact the node isn’t running, e.g. if the script gets into a loop where it cannot start the node.