Linux technical support - [email protected]


systemd

example

[root@xyml ~]# cat /usr/lib/systemd/system/syncthing.service
[Unit]
Description=syncthing
  
[Service]
User=apache
Group=apache
EnvironmentFile=/etc/syncthing.env
ExecStart=/bin/syncthing $syncthing_params
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
  
[Install]
WantedBy=multi-user.target
[root@xyml ~]# cat /etc/syncthing.env
syncthing_params='-gui-address="172.20.0.9:3443"'

monitoring and restart

[Service]
# MONITOR AND RESTART SERVICE IF FAIL DURING 10 SECONDS
Restart=always
RestartSec=10
# START DELAY, TimeoutStartSec SHOULD BE MORE THEN ExecStartPre
TimeoutStartSec=300
ExecStartPre=/bin/sleep 200
# show daemons status
systemctl list-unit-files

# show daemons verbose
systemctl list-units

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>