I think the issue is with running Syncthing as a user service: User services are started/stopped when a user logs in/out. If you want to run Syncthing on a server constantly you want to run it as a system service: Don’t use --user and add the username to the service (like syncthing@yourusername). You’ll need root/sudo privileges to do this.
System service not necessarily necessary but @imsodin is (probably) right on for issue. Assuming @imsodin nailed the issue instead of @AudriusButkeviciustry try running this:
To run this automatically there are other ways to do it (.profile, ect) but easiest to have Syncthing run automatically on headless server is to set a cronjob with the above command to run every minute or every five minutes. Nothing will happen if Syncthing is already running.
Hello @shnappi, yeah he is probably right, will test soon. I think im going to reinstall the systemd service or the full software, and start again with “correct way” …i think? I try not to use customs scrips / commands since its more difficult for me to keep record of such things. Will report back tomorrow
Good luck. Nothing is custom above. Nohup does not require any packages and will work on all Unix systems. It basically disconnects the command from the individual SSH session so it will continue to run after the session closes. The latter part redirects the output that you will normally get from running Syncthing in a command line. This is necessary because Syncthing’s “-no-console” only works on Windows.
See the docs for using systemd, in particular, the difference between a system service (which starts on boot) and a user service (which starts when you log in).
Sorry youre right, im old and wary of new commands, never saw that one ;). You were right @schnappi, the issue was the systemd running as a user instead of a system service, i just reinstalled as the second one and everything is working perfectly, Thanks for the help!
Problem its that i was running syncthing as an user server, so when the user disconects the SSH session, the process is killed aparently.
Reinstalled synchting as a system service:
sudo systemctl enable syncthing@syncthing-server.service
sudo systemctl start syncthing@syncthing-server.service
And now its working perfectly, thanks everyone for the help.
PD: Will write a guide about headless server, there is some but a little outdated or incomplete.