2014-08-21 13:43:55 -06:00
|
|
|
function make_me_synergy() {
|
|
|
|
local new_host_name="$(echo $SSH_CONNECTION | get_cols 1)"
|
|
|
|
while getopts "h:" OPTCHAR; do
|
|
|
|
case $OPTCHAR in
|
|
|
|
h)
|
|
|
|
new_host_name="$OPTARG";
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2014-08-21 18:19:42 -06:00
|
|
|
test -z "$(get_synergy_pids_for_ip $new_host_name)" && synergyc $new_host_name
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function stop_synergy_at() {
|
2014-08-23 18:00:27 -06:00
|
|
|
pgrep synergys | xargs kill -9
|
2014-08-21 13:43:55 -06:00
|
|
|
ssh $1 "source ~/.zshrc && clear_my_synergy"
|
|
|
|
}
|
|
|
|
|
|
|
|
function clear_all_synergy() {
|
2014-08-23 18:00:27 -06:00
|
|
|
pgrep synergy | xargs kill -9
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function clear_my_synergy() {
|
|
|
|
clear_synergy_for_ip "$(echo $SSH_CONNECTION | get_cols 1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_synergy_pids_for_ip() {
|
|
|
|
ps aux | grep synergyc | grep $1 | get_cols 2
|
|
|
|
}
|
|
|
|
|
|
|
|
function clear_synergy_for_ip() {
|
2014-08-23 18:00:27 -06:00
|
|
|
get_synergy_pids_for_ip $1 | xargs kill -9
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function activate_synergy_for() {
|
2014-08-24 14:45:02 -06:00
|
|
|
test -z "$(pgrep synergys)" && synergys --config ~/synergy.conf
|
2014-08-21 18:13:14 -06:00
|
|
|
ssh $1 "source ~/.zshrc && make_me_synergy"
|
2014-08-21 13:43:55 -06:00
|
|
|
}
|