Have to wake up Syncthing via the web GUI

I have Syncthing running on a dedicated server (Hetzner) under Arch Linux. Connected is primarily my Android phone. After a while, when I open Syncthing on the phone, it says that the other device, i.e. the server, is disconnected. From Syncthing on the phone, it seems I can to nothing to stimulate the server to do its thing.

What works is: I log into the server by SSH and connect to Syncthing web GUI (port forwarding). Then syncing starts immediately.

How do I prevent Syncthing from falling asleep?

Syncthing stable branch is installed in user space on the server. It is started via Systemd. ~/.config/systemd/user/syncthing.service:

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
StartLimitIntervalSec=60
StartLimitBurst=4

[Service]
ExecStart=%h/.local/syncthing/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

# Elevated permissions to sync ownership (disabled by default),
# see https://docs.syncthing.net/advanced/folder-sync-ownership
#AmbientCapabilities=CAP_CHOWN CAP_FOWNER

[Install]
WantedBy=default.target

Don’t run syncthing as a systemd user service. This is usually tied to your current SSH login and will be stopped with your active session.

Use a system service bound to your user of choice instead:

systemctl --user disable --now syncthing
sudo systemctl enable --now syncthing@YOUR_USERNAME_HERE
3 Likes

Thanks! That pointed me in the right direction. And I found a solution that can keep me managing the service as user yet still have it start at boot:

sudo loginctl enable-linger felix
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.