Page tree
Skip to end of metadata
Go to start of metadata

The following systemunit can be used on  Ubuntu to control t5memory:

/etc/systemd/system/t5memory.service
[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: 

  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 mail@mail.net (see onRestartService.sh)

  • No labels