Project D

Synergy Init.d script

I have written about running synergy in your gentoo linux sometimes ago and chooses to use crontab plus bash script to load and check for synergy to run and re-run if it died.

Now I think the init.d method of running synergy is much better than bash script.

here is the script

#!/sbin/runscript
# /etc/init.d/synergy
# $Header: $

depend() {
use xdm net
}

start() {
ebegin "Starting synergy"
# the following line might be necessary to allow the connection to the x-server
export XAUTHORITY=/home/${SYNERGY_USER}/.Xauthority
start-stop-daemon --start -b -v -p /tmp/synergy.pid -m -c ${SYNERGY_USER} -x ${SYNERGY_EXEC} -- ${SYNERGY_OPTS}
eend $? "Failed to start synergy"
}

stop() {
ebegin "Stopping synergy"
start-stop-daemon --stop -x ${SYNERGY_EXEC} -p /tmp/synergy.pid -q
eend $? "Failed to stop synergy"
}

the configuration file

#/etc/conf.d/synergy

SYNERGY_EXEC="/usr/bin/synergyc"
SYNERGY_USER="YOUR_USERNAME"

#Usage: synergys [--address <address>] [--config <pathname>] [--debug <level>] [--display <display>] [--name <screen-name>] [--restart|--no-re
#
#Start the synergy mouse/keyboard sharing server.
#
# -a, --address <address> listen for clients on the given address.
# -c, --config <pathname> use the named configuration file instead.
# -d, --debug <level> filter out log messages with priorty below level.
# level may be: FATAL, ERROR, WARNING, NOTE, INFO,
# DEBUG, DEBUG1, DEBUG2.
# --display <display> connect to the X server at <display>
# -f, --no-daemon run the server in the foreground.
#* --daemon run the server as a daemon.
# -n, --name <screen-name> use screen-name instead the hostname to identify
# this screen in the configuration.
# -1, --no-restart do not try to restart the server if it fails for
# some reason.
#* --restart restart the server automatically if it fails.
#SYNERGY_OPTS="-f -a hostnameoripofclient(s) --display ':0' -n gentoo"
SYNERGY_OPTS="-f PUT_YOUR_LAPTOP_IP_ADDRESS_HERE"

You need to change the configuration file bases on will synergy be run as server or client?.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Slashdot
  • StumbleUpon
  • blinkbits
  • eKudos
  • Live
  • Share/Save/Bookmark

RSS Fresh Ebuild