Created
August 4, 2016 06:26
-
-
Save chopfitzroy/c2d910f9e495f4506916e12cf2b6051d to your computer and use it in GitHub Desktop.
Synergy multiple servers for one client
This file contains 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 | |
# 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