Skip to content

Instantly share code, notes, and snippets.

@lopugit
Created September 22, 2018 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lopugit/9691bd72524c5d6fbc97bd32db350069 to your computer and use it in GitHub Desktop.
Save lopugit/9691bd72524c5d6fbc97bd32db350069 to your computer and use it in GitHub Desktop.
auto connect synergy to any list of ip addresses synergy listening server
#!/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