sudo vim /etc/systemd/system/syncthing.service
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
RestartSec=5
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
# Hardening
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
[Install]
WantedBy=default.target
Set syncthing as a service.
sudo systemctl daemon-reload
sudo systemctl enable syncthing
sudo systemctl start syncthing
sudo systemctl status syncthing
It encounter wrong info:
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
Loaded: loaded (/etc/systemd/system/syncthing.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-06-01 07:05:47 UTC; 1s ago
Docs: man:syncthing(1)
Process: 1332 ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0 (code=exited, status=1/FAILURE)
Main PID: 1332 (code=exited, status=1/FAILURE)
Jun 01 07:05:47 vultr.guest systemd[1]: syncthing.service: Main process exited, code=exited, status=1/FAILURE
Jun 01 07:05:47 vultr.guest systemd[1]: syncthing.service: Unit entered failed state.
Jun 01 07:05:47 vultr.guest systemd[1]: syncthing.service: Failed with result 'exit-code'.
It is no use to change the
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
into
ExecStart=/usr/bin/syncthing
How to set syncthing as a service ?
5 posts - 2 participants