-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control Syncthing when on different wifi networks #172
Comments
Uhg I just got So I'm coming from windows and I know that syncthing on windows does not like to be improperly shutdown and improperly shutting down can cause some nasty corruption. But idk how syncthing behaves on macos. What is the safest way to shutdown syncthing from the terminal if syncthing-macos is installed? Or is it not possible? Thank you in advance! |
Hi @qcksilver, The syncthing-macos application bundle indeed manages the syncthing process. It automatically restarts when syncthing crashes (which almost never happens) or gets killed. You should stop syncthing from the application bundle as follows: The behaviour is intended because else people must manage syncthing process themselves and now it is a seamless experience so people don't have to setup e.g launchd syncthing service. |
The unix command |
Ah I see. Thanks! So just to confirm (sorry I'm a n00b at macos), I don't need to send the CURL API /rest command first, I can just I'm trying to write a script to only open syncthing-macos if I'm connected to specific wifi networks. And to safely shutdown syncthing if it's running and I connect to any other network. |
I think with your use-case you should not kill/stop syncthing daemon, but better pauze all syncing devices which puts syncthing in a 'standby' state. Then the syncthing daemon will stay running and the syncthing-macos tray application doesn't restart after kill. Better use the Good luck! |
That could definitely work, thanks! |
@qcksilver when you figured out how to get it working maybe post here the solution for other people who like this. Feel free to ask questions if you don't get it working, i'm willing to help for a solution. |
Are u using |
I started by trying to use the Shortcuts app since I'm new to mac, and I did manage to get a working shortcut, but it can only be run manually and I got a bit frustrated by the limitations of shortcuts, so I started trying to just build a bash script. Shortcuts was a good starting point for getting familiarized with macos though, so I don't regret the time I spent in it.
The one thing that was easy in the shortcuts app was getting SSID names, and I hadn't figured out how to do it in bash yet, so you just saved me a MASSIVE amount of time. Thank you!!! |
Yeah the GUI applications for on Mac are "simple" but if you look under the hood it a UNIX-like operating system with a rock solid desktop. If you want to dive-deep you should indeed get into the commandline (and install Homebrew and iTerm2 from homebrew). Homebrew is like For scheduling periodic tasks/scripts the UNIX (user) cron scheduler can be used so in the background your Wifi polling script controls Syncthing. More info for example here. |
Hi @qcksilver when I was hacking on the code I saw we never set the |
After some discussions on the forum the |
I'm on a M1 MacBook Pro Monterey version 12.1 (21C52)
I'm using syncthing-macos version 1.18.5-1
I'm trying to safely shutdown Syncthing from the terminal and I can't get it to work. I'm a new Mac user, so it's hard for me to know if this is just user error or if I've found a bug.
When I input:
CURL -X POST -H "X-API-Key:" http://127.0.0.1:8384/rest/system/shutdown
It outputs
{"ok": "shutting down"}
So I know the command was correct, but syncthing doesn't actually shutdown.
Sometimes the syncthing-macos menu bar icon very briefly shows syncthing as offline, so I'm wondering if syncthing-macos is restarting syncthing.
Does syncthing-macos automatically restart syncthing if it detects it's not running, even if syncthing got a valid shutdown command?
Is this it's intended behavior?
I also tried to add
pkill syncthing
after the shutdown command to kill syncthing-macos before it restarts syncthing, butpkill syncthing
doesn't seem to actually kill the app.The text was updated successfully, but these errors were encountered: