...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
[Unit] Description=T5Memory After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service StartLimitIntervalSec=60 StartLimitBurst=5 [Service] Restart=on-failure RestartSec=5s ExecStart=/home/translate5tmservice/t5memory-0.2.0-Linux/bin/t5memory WorkingDirectory=/home/translate5tmservice/ User=translate5tmservice ExecStopPost=/bin/bash /home/translate5tmservice/onRestartService.sh StandardOutput=file:/home/translate5tmservice/log/stdout.log StandardError=file:/home/translate5tmservice/log/stderr.log [Install] WantedBy=multi-user.target |
Line 6 and 7 are used to limit automatic restarts to prevent restart dead loops. How ever, if the limit is reached, the service must be started manually:
Code Block | ||
---|---|---|
| ||
systemctl reset-failed t5memory
systemctl start t5memory |
Binary path
The called binary "/home/translate5tmservice/t5memory-0.2.0-Linux/bin/t5memory" is a symlink to the versioned binaries in the same directory. So on updating the service must be stopped, the symlink changed, then the service started again.
TODO: test if the above order is really needed or if the service is also stopped when the symlink was changed before stopping.
Logs
The usage of files for StandardOutout and StandardError makes currently sense for development. For production the usage of the system journal / syslog makes more sense.
ExecStopPost
If the service is stopped, the logs are renamed to the current date and an email is send to support@translate5.net (see onRestartService.sh)