Skip to content

Instantly share code, notes, and snippets.

@chopfitzroy
Created August 4, 2016 06:26
Show Gist options
  • Save chopfitzroy/c2d910f9e495f4506916e12cf2b6051d to your computer and use it in GitHub Desktop.
Save chopfitzroy/c2d910f9e495f4506916e12cf2b6051d to your computer and use it in GitHub Desktop.
Synergy multiple servers for one client
#!/bin/bash
# IP address to cycle through (in order of priority)
ip=( "192.168.20.102" "192.168.20.103" )
# Check if synergy is already connected
if pgrep "synergyc"; then
# Synergy already connected
echo "Synergy is already running."
else
# Loop over ip's
for i in "${ip[@]}"
do
# Ping ip with default synergy port
nc -z "$i" 24800
if [ "$?" -eq 0 ]; then
# Connect synergy if ip available and synergy port active
/usr/bin/synergyc --no-restart -n media -f "$i"
# Use no-restart so if connection is cut synergy stops.
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment