#!/bin/sh control_c() { echo "Shutting down..." pkill synergyc sleep 1 # give some moments to go quietly if [ -z `pgrep synergyc` ]; then # then kill with hostility... pkill -9 synergyc fi exit $? } # trap any kind of interruption trap control_c HUP INT QUIT ABRT # main() loop if [ "$1" = "-h" -o "$1" = "--help" ]; then echo "Reliable Synergyc:" echo "Usage: $(basename $0) " exit fi while true do if [ -z `pgrep ^synergyc` ]; then echo "Connecting to $1" /usr/bin/synergyc $1 fi sleep 3 done