Last active
May 8, 2018 00:45
-
-
Save smartwatermelon/0fd01d2dc4d3aee4d89d590fb2ab72c5 to your computer and use it in GitHub Desktop.
reset the Synergy 1.x server and client processes after sleep/wake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
## this runs on the Synergy *server* Mac and assumes the *client* is connected via bridge0 | |
## server: 169.254.168.87 ; client: 169.254.168.86 | |
## use e.g. ControlPlane to run the script on wake | |
## brew install terminal-notifier | |
## use ssh-copy-id to enable passwordless ssh from the server to the client | |
## add to /etc/sudoers.d/youruser e.g. $YOUR_USER ALL=(ALL) NOPASSWD: /usr/bin/killall,/sbin/ifconfig | |
## replace $YOUR_USER with your username on the client | |
echo "bouncing Synergy..." | terminal-notifier -title controlplane | |
sudo ifconfig bridge0 down | |
sleep 1 | |
sudo ifconfig bridge0 up | |
until ip -4 addr show bridge0 | grep UP; do sleep 1; done | |
until ( ssh -o ConnectTimeout=2 [email protected] hostname ); do sleep 2; done | |
ssh [email protected] 'echo "bouncing Synergy..." | /usr/local/bin/terminal-notifier -title Synergy; sudo ifconfig bridge0 down; sleep 1; sudo ifconfig bridge0 up; until /usr/local/bin/ip -4 addr show bridge0 | grep UP; do sleep 1; done; ifconfig bridge0; killall synergyc; until /usr/bin/pgrep synergyc; do sleep 1; done; echo "done bouncing Synergy..." | /usr/local/bin/terminal-notifier -title Synergy;' | |
killall synergys | |
until pgrep synergys; do sleep 1; done | |
echo "done bouncing Synergy..." | terminal-notifier -title controlplane |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment