Skip to content

Instantly share code, notes, and snippets.

@iuridiniz
Created May 24, 2012 13:29
Show Gist options
  • Save iuridiniz/2781555 to your computer and use it in GitHub Desktop.
Save iuridiniz/2781555 to your computer and use it in GitHub Desktop.
ssh rc script ($HOME/.ssh/rc) in order to start synergyc
#!/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