stcli, or how to pause/resume sync from CLI in 2022

I’m trying to control Syncthing such that it does not blow through my cell data bandwidth when I’m tethering. Pause resume folder using CLI suggests I use stcli, and that I can find it in the tools build artifacts, but looking at Log in to TeamCity — TeamCity for instance does not show an stcli utility.

Ship stcli in main package · Issue #6566 · syncthing/syncthing · GitHub suggests it might eventually get merged into the main syncthing binary, but as of 1.22.1 this doesn’t appear to be the case. if I run Syncthing --help or cli it seems that the main application assumes it is the daemon and fails because Syncthing is already running.

I suggest simply shutting it down.

But if you want specifically to pause something, that is merged into the main binary now. For example, to pause a folder,

syncthing cli config folders $folderID paused set true

or a device

syncthing cli config devices $deviceID paused set true
1 Like

Ahh, I see my issue now.

/Applications/ is not the correct command, it is /Applications/ which has the command line interface.

Using WifiWatch and this little script, I’m able to achieve what I’m after. Thank you so much!

$ cat ~/.wifiConnected

# space-separated list of SSIDs which should pause syncing
nosyncnet="phone_ssid metered_wifi_ssid"


for net in ${nosyncnet} ; do
	if [ "${net}" = "${newnet}" ] ; then

echo "`date`: connected to \"${newnet}\", disconnected from \"${oldnet}\", paused is ${paused}" >> /tmp/wifiConnected.log

# use this if you want to pause/resume by device(s)
#for dev in `${stcli} cli config devices list`; do
#	${stcli} cli config devices $dev paused set ${paused}

# use this if you want to pause/resume by folder(s)
for f in `${stcli} cli config folders list`; do
	${stcli} cli config folders $f paused set ${paused}

Thank you so much!
I was looking for the equivalent of ifup/ifdown scripts on macos and only found really old projects that I thus discounted. Good to see that this one is old because it’s simple enought to still work even after 5+ years of no commits :slight_smile:

1 Like

Yep – I had ControlPlane for a while, but couldn’t find something that would work even with old 10.15 which I am very reluctant to move past. Lots of abandonware and unfortunately I can’t even use XCode and Homebrew is getting harder to use since both have deprecated 10.15, but fortunately WifiWatch is simple enough and just calls a shell script which offers the flexibility I needed. Not just for Syncthing but other things as well, such as time machine.

It’s frustrating that the more OSX matures it seems the more they are locking things down and removing flexibility.

Ah so maybe it won’t even work for me, I am on almost the latest and don’t have control what I am on (I also don’t care much, not on macos by choice :slight_smile: ). I’ll check it out tomorrow.
Edit: And it just works - yeii!

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