Created
September 22, 2018 07:54
-
-
Save lopugit/9691bd72524c5d6fbc97bd32db350069 to your computer and use it in GitHub Desktop.
auto connect synergy to any list of ip addresses synergy listening server
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