pages:scripts:synergy-ctl
synergy-ctl
#!/bin/bash # set -x setxkbmap de OP=${1} # put the synergy server IP here (at boot time name lookup does not work # and synergyc will fail and exit, using the IP prevents the problem) SERVER_IP=10.0.10.1 SYNERGYC=/usr/bin/synergyc PS=/bin/ps GREP=/bin/grep WC=/usr/bin/wc PIDOF=/bin/pidof SLEEP=/bin/sleep # check synergyc is running function f_check { N=`${PS} -ef | ${GREP} "${SYNERGYC}" | ${GREP} -v "${GREP}" | ${WC} -l` return $N } # kill synergyc if running function f_kill { SIG="" while true do f_check if [ $? -eq 1 ] then PIDS=`${PIDOF} "${SYNERGYC}"` if [ ${PIDS} != "" ] then kill ${SIG} ${PIDS} fi else break fi ${SLEEP} 1 SIG="-9" done } # start synergyc function f_start { while true do ${SYNERGYC} --enable-crypto -n dede "${SERVER_IP}" ${SLEEP} 2 f_check if [ $? -eq 1 ] then break fi done } case "${OP}" in start) f_kill f_start ;; stop) f_kill ;; *) echo "usage: synergyc-ctl [start|stop]" exit 1 ;; esac exit 0
pages/scripts/synergy-ctl.txt · Last modified: 2022/12/31 01:04 by Heiko Mischer