Would it be possible to ad an option to syncthing that made it start in the background, just showing a system try icon and not opening a shell window?
In our target environment, we have the computers locked down to the point where shell windows can’t be opened (for securety reasons), and thus syncthing won’t start.
This goes kind of in the directon of this topic, but the important thing for us is not so much tray notifications but the fact that it starts even when it can’t open up a shell window.
If i understood your request, I think you can setup Syncthing to start in background at boot with user privileges.
I have add this line to my /etc/rc.local:
su -l <youruser> -c /home/<youruser>/<syncthing-folder>/syncthing &
Or you can change the location of your syncthing directory (if you put in /bin is
su -l <youruser> -c /bin/syncthing & )
Can be useful? Not beautiful, very “old school”, but works for me!
I suspect this is for Windows. There is a way to compile/modify a syncthing binary to not use a shell window. That requires some tinkering, and I’m not sure if it also makes it impossible to get at the console log in general. Would need to do some investigation.
Create a window service for syncthing. IMHO it’s not needed to change anything, it should be possible to use the current syncthing.exe to create a windows service.
I have been trying to achieve the same and from my testing it appears that syncthing is unable to reply to service control manager with expected output and so will not start.
However, I have discovered a workaround; creating a batch file which runs the .exe and schedule a task to run it when idle with your required timescale. I currently have set mine to 1 minute (as that’s what syncthing is configured as) and works like a charm!
We are now using runAsService in order to create a syncthing background task. Important to note is that when you do that, make sure to tell syncthing where its configuration files are (via “-home” parameter), as it will not be able to access any default home folder when running as a service.
rem stelss bat
@echo off
rem create work bat
echo dir /s c:\^>log.txt>wait.cmd
rem Script file cooking
echo Set WshShell = CreateObject("WScript.Shell") >start.vbs
echo WshShell.Run "d:\apps\syncthing\syncthing.exe", 0, false>>start.vbs
rem run cooked script, dont wait exit
cscript.exe //b //nologo start.vbs
rem del temped files
del /f /q start.vbs
del /f /q wait.cmd
place 1.cmd to you application folder (d:\apps\synthing)
I added a new command line flag -no-console to the Windows build. This causes syncthing to release the console, but it is still allocated on startup so you’ll see a brief flash of console window on startup… But at least it doesn’t hang around forever. It’s probably easiest to use a shortcut to set the flag:
When doing this, there’ll be no indication at all that syncthing is running, apart from being visible in the task manager and the web gui being accessible. Obviously it’d be nice with a tray icon, etc, but that’s for another day (and perhaps another developer).
Hmm, apparently restart no longer works when running without a console (it simply exits); not sure why, so that’s something to be aware of for the moment.