Update syncthing guide (https://webinstall.dev/syncthing/) for system execution?
At https://webinstall.dev/syncthing/ the serviceman command used to create a Syncthing service for the current user is:
env PATH="$PATH" serviceman add --user --name syncthing -- syncthing --home ~/.config/syncthing/
How can I modify the above line to create a service for starting Syncthing at system startup independently of users logging in? Would that simply become:
env PATH="$PATH" serviceman add --system --name syncthing -- syncthing --home ~/.config/syncthing/
Yes I am aware this would (if correct) start the specifc Syncthing instance installed by the user below their home dir, but I would be fine with that.
Btw, what's the meaning of PATH="$PATH" ?
Ok I think the correct way to do this for a service installed with webinstall by a regular user within their home dir, is to leave untouched the original serviceman command:
env PATH="$PATH" serviceman add --user --name syncthing -- syncthing --home ~/.config/syncthing/
and then, agin from the user shell do:
loginctl enable-linger $USER
which enables user lingering as explained here https://mycorrhiza.wiki/hypha/systemd_101 meaning user services will keep running even when the user is not connected, making it work similarly, I guess, to a system service.
Can someone confirm this is ok? If so, please consider addng it to https://webinstall.dev/syncthing/ as I'm certain it would save quite a few headaches...
@illtellyoulater It looks like you're running this on Linux?
I think it's fine to use enable-linger, but I also think a system service might be more appropriate for your use case.
When I'm on Linux I'm almost exclusively using --system --username "$(id -u -n)".