diff options
Diffstat (limited to 'desktop/synergy-plus/rc.synergys')
-rw-r--r-- | desktop/synergy-plus/rc.synergys | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/desktop/synergy-plus/rc.synergys b/desktop/synergy-plus/rc.synergys new file mode 100644 index 0000000000000..61f72afcf0395 --- /dev/null +++ b/desktop/synergy-plus/rc.synergys @@ -0,0 +1,70 @@ +#!/bin/bash +# +# By Steven King 11/3/2010 +# kingrst@gmail.com +# +# Modified by Pierre Cazenave 3rd November 2010 +# pwcazenave <at> gmail {dot} com +# +# Starts the Synergy-Plus Server +# + +synergy_start() { + + if [ -f /var/run/synergys.pid ]; then + echo "Synergy Server is already running" + exit 1 + elif [ -x /usr/bin/synergys ]; then + /usr/bin/synergys || exit $? + + pidof synergys > /var/run/synergys.pid + echo "Synergy Server Started" + fi + +} + +synergy_stop() { + + if [ -f /var/run/synergys.pid ]; then + kill $(cat /var/run/synergys.pid) || echo "Unable to stop Synergy Server" + + rm -f /var/run/synergys.pid + echo "Synergy Server Stopped" + else + echo "Synergy Server is not started" + fi + +} + +synergy_status() { + + if [ -f /var/run/synergys.pid ]; then + echo "Synergy Server Running" + echo "PID: $(cat /var/run/synergys.pid)" + else + echo "Synergy Server is not started" + fi + +} + + +case "$1" in + "start") + synergy_start + ;; + "stop") + synergy_stop + ;; + "status") + synergy_status + ;; + "restart") + synergy_stop + sleep 1 + synergy_start + ;; + *) + echo "$0 Usage: [start|stop|restart|status]" + ;; +esac + |