Last active
May 8, 2017 10:39
-
-
Save Synergyst/b74dca48a9163ebcc60305deebb6a86a to your computer and use it in GitHub Desktop.
Symless Synergy VNC Detection Script
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 | |
while true ; do | |
if [[ `ps aux | grep synergy | grep -v "Sl+" | grep -v "S+" | awk '{print $8}'` != "" ]]; then | |
echo "Found and killing duplicate Synergy session.." | |
(sleep 5 ; kill `ps aux | grep synergy | grep -v "synergys" | grep -v "Sl+" | grep -v "S+" | awk '{print $2}'` ; killall droidmote ; sleep 5 ; synergy-wrapper) & | |
fi | |
if [[ `cat /tmp/synergy-start-stop-disable-state` == "allow" ]]; then | |
if [[ `ps aux | grep synergy | grep -v "synergys" | grep -v "grep" | awk '{print $8}' | grep "Sl+"` != "Sl+" && `ps aux | grep synergy | grep -v "synergys" | grep -v "grep" | awk '{print $8}' | grep "S+"` != "S+" ]]; then | |
echo "Executing Synergy GUI via wrapper.." | |
./droidmote 2302 PocoCraftHN 2>&1 >/dev/null & | |
synergy | |
exit $? | |
elif [[ `ps aux | grep synergy | grep -v "grep" | grep -v "synergys" | awk '{print $11}'` == "synergy" ]]; then | |
echo "Synergy GUI is already running.." | |
#exit 0 | |
fi | |
echo "sleeping for 5.." | |
sleep 5 | |
else | |
echo "sleeping for 15.." | |
sleep 15 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment