I’ve done this for four other machines, but for some reason, it fails on this one.
SystemD Files:
sudo nano [email protected]
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
[Service]
User=%i
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=multi-user.target
sudo nano syncthing-resume.service
[Unit]
Description=Restart Syncthing after resume
Documentation=man:syncthing(1)
After=sleep.target
[Service]
Type=oneshot
ExecStart=-/usr/bin/pkill -HUP -x syncthing
[Install]
WantedBy=sleep.target
systemctl enable [email protected]
systemctl start [email protected]
…but I get:
Aug 28 23:41:55 server systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for myuser.
Aug 28 23:41:55 server systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for myuser.
Aug 28 23:41:55 server systemd[12450]: [email protected]: Failed to determine user credentials: No such process
Aug 28 23:41:55 server systemd[12450]: [email protected]: Failed at step USER spawning /usr/bin/syncthing: No such process
Aug 28 23:41:55 server systemd[1]: [email protected]: Main process exited, code=exited, status=217/USER
Aug 28 23:41:55 server systemd[1]: [email protected]: Failed with result 'exit-code'.
Aug 28 23:41:55 server systemd[1]: [email protected]: Service RestartSec=100ms expired, scheduling restart.
Aug 28 23:41:55 server systemd[1]: [email protected]: Scheduled restart job, restart counter is at 5.
Aug 28 23:41:55 server systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for myuser.
Aug 28 23:41:55 server systemd[1]: [email protected]: Start request repeated too quickly.
Aug 28 23:41:55 server systemd[1]: [email protected]: Failed with result 'exit-code'.
Aug 28 23:41:55 server systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for myuser.
I decided to focus my research on the ‘Failed to determine user credentials’ and came upon [ THIS ], though related to PostGreSQL, discusses the same issue.
It suggested systemctl daemon-reexec
, hey presto, it works.