When STNORESTART=yes is set, Syncthing/Pulse returns 3 as an exit code and Systemd will not restart it unless you add SuccessExitStatus=3 to the service file. A restart from the web gui would not work otherwise.
[Unit]
Description=Syncthing service for %i
After=network.target
[Service]
User=%i
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing
Restart=on-success
SuccessExitStatus=3
[Install]
WantedBy=multi-user.target
I did not miss the install message. Do you know why this is? I would like it better, when this service is controlled by the user itself, that is why I tried to get it working with systemctl --user.
Is there any reason why you canāt just sudo systemctl? The service runs as the user anyway. And it can restart itself once itās started. (or you can kill it and have systemd restart it for you).
Like I said, as a user space process it should be controlled by the user. The user can not stop or start any services of this type, because the service was set by the super user. Correct if I am wrong but I think that the service is started at system start and therefore can affect the overall performance depending on the number of users using syncthing, repositories and so on. The user service manager (systemctl --user) is started on the first log in of the according user and its logs can only be viewed by the according user (privacy). I know for a single user system there is no difference but for multi user systems it makes sense to use the user service manager and I am always glad to keep my activities in user space
As I said before, the above script runs the service as the configured your (eg: your user, not root), even if itās started by root (systemd will change user before starting the process). (Iām assuming thatās what you refer to with āuser spaceā, since syncthing canāt run outside user space).
I do agree on the multi-user point; syncthing may degrade performance on shared hosts or have other undesired effects. Just also keep in mind that by running with systemd --user syncthing will not sync files until you log in on more than one host simultaneously.
I have debian, used this init.d script mixed with this installation guide. Result is that I have syncthing running as a dameon/service by user syncthing. It was working ok for few days, but now I cannot connect to web guiā¦ when I go to my IP:port there is no response, it jsut loads forever.
The syncthing pseems to be running because:
syncthing@cedrus:$ sudo service syncthing status
syncthing for USER syncthing: running (pid 2268024987)
It looks like for whatever reason the /etc/init/syncthing.conf is missingā¦ there is no such fileā¦
I find out that the syncthing confing is actually in home directory ./config/syncthing/config.xml
there in the config in the gui section was some ā> api keyā which i dont remember setting, so I removed it
Then for whatever reason the service syncthing status was returning 6 processes, so I killed them all, and restarted as service syncthing start
and it works againā¦
wonder why this all happenedā¦
I am evaluating syncthing as a replacement for my dropbox, but so far it is too much geeky, expecially the server part (syncthing running as daemon on my little debian box)ā¦