Created
May 24, 2012 13:29
-
-
Save iuridiniz/2781555 to your computer and use it in GitHub Desktop.
ssh rc script ($HOME/.ssh/rc) in order to start synergyc
This file contains hidden or 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/sh | |
# Author: Iuri Gomes Diniz <[email protected]> | |
getSSHclient() { | |
set -- $SSH_CLIENT | |
export CLIENT_IP="$1" | |
} | |
. /usr/share/acpi-support/power-funcs | |
. /lib/lsb/init-functions | |
# SETS DISPLAY | |
getXconsole | |
# SETS CLIENT_IP | |
getSSHclient | |
log_daemon_msg "Killing others 'synergyc' to your ip ($CLIENT_IP)" | |
#killall synergyc 2>/dev/null >/dev/null | |
(pgrep -lf 'synergyc --display' | grep $CLIENT_IP | awk '{print $1}' | xargs kill -9) >/dev/null 2>&1 | |
log_end_msg $? | |
log_daemon_msg "Enabling X connections to my display ($DISPLAY) from your ip ($CLIENT_IP)" | |
xhost "+$CLIENT_IP" >/dev/null 2>&1 | |
log_end_msg $? | |
log_daemon_msg "Starting 'synergyc' from my display ($DISPLAY) to your ip ($CLIENT_IP)" | |
synergyc --display "$DISPLAY" "$CLIENT_IP" >/dev/null 2>&1 | |
log_end_msg $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment