I managed to get my hands on the “.service” files:
/etc/systemd/system/syncthing.service:
[Unit]
Description=Syncthing
[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/syncthing > /var/log/syncthing.log &'
ExecStop=/usr/bin/killall -w syncthing
RemainAfterExit=yes
User=root
[Install]
WantedBy=multi-user.target
For syncthing-inotify:
/etc/systemd/system/syncthing-inotify.@service :
[Unit]
Description=Syncthing Inotify File Watcher for %I
Documentation=https://github.com/syncthing/syncthing-inotify/blob/master/README.md
After=network.target syncthing@.service
Requires=syncthing@.service
[Service]
User=%i
ExecStart=/usr/bin/syncthing-inotify -logflags=0
SuccessExitStatus=2
RestartForceExitStatus=3
Restart=on-failure
ProtectSystem=full
ProtectHome=read-only
[Install]
WantedBy=multi-user.target
And etc/systemd/user/syncthing-inotify.service:
[Unit]
Description=Syncthing Inotify File Watcher
Documentation=https://github.com/syncthing/syncthing-inotify/blob/master/README.md
After=syncthing.service
Requires=syncthing.service
[Service]
ExecStart=/usr/bin/syncthing-inotify -logflags=0
SuccessExitStatus=2
RestartForceExitStatus=3
Restart=on-failure
ProtectSystem=full
ProtectHome=read-only
[Install]
WantedBy=default.target
Any help sincerely appreciated.
Thank you for your time and patience.
1 Like
canton7
(Antony Male)
December 8, 2016, 10:16am
22
Right, I think you need to start syncthing-inotify with systemctl enable/start/status syncthing-inotify@root.service
, to tell it to run as root.
1 Like
rumpelsepp
(Stefan Tatschner)
December 8, 2016, 12:29pm
23
Sciamano72:
[Unit]
Description=Syncthing
[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/syncthing > /var/log/syncthing.log &'
ExecStop=/usr/bin/killall -w syncthing
RemainAfterExit=yes
User=root
[Install]
WantedBy=multi-user.target
This file is plain wrong:
It starts syncthing is root; there is no possibility to overwrite it.
It uses some bash Foo in order to create a logfile
The type is oneshot (i guess because of the bash foo?)
I would recommend that you replace it with the service file provided by upstream . Then you can just use the instructions from us to run it.
2 Likes
Ok, thanks a lot for your insight. I’m not sure why syncthing is run that WAY. Could it be because DietPi keeps logging in the RAM (to avoid the SD card to be written too frequently)?
Anyway:
Running systemctl enable/start/status syncthing-inotify@root.service does not work. It starts but it doesn’t detect any file changes.
Tomorrow I will try changing the service for syncthing to the one provided by upstream, and see if it works. Otherwise I guess I’ll have to ask the DietPi maintainer to fix this.
I’ll report back after the necessary testing. Thanks a lot for your help so far.
rumpelsepp
(Stefan Tatschner)
December 8, 2016, 10:01pm
25
As I said there is no templating in this service. So @foo
does nothing in your case.
Sorry I’m a muppet.
LOL, it’s OK. I really appreciate every effort to help.
1 Like
system
(system)
Closed
January 7, 2017, 11:18pm
27
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.