Skip to content
the-wes edited this page Mar 24, 2016 · 3 revisions

Table of Contents

How to make Synergy run automatically at startup

Windows

The official way is to use the Windows service feature in 1.4+ which works with Windows XP and newer. This is now the default behavior upon installation. To have Synergy not start on boot, you need to edit the properties of the service and set it to Manual.

Mac

In OSX 10.8 and older, you can use a plist through launchd. There's also an example of this method in the source code.

There is not currently a known way to do this in OSX 10.9 or newer. In all versions of OSX, you can have the user login automatically, and set Synergy as a Login Item, which will have it start up upon user login.

Linux

Originates from Bug #1755

Howto start synergy client (synergyc) at boot on FC11 (Fedora Core 11)

This is not really a bug report - but just some hints how to successfuly install synergyc so that it start at boot in Fedora Core 11. Please integrate this in the main help.

/etc/gdm/Init/Default:
# This script needs to start synergyc as user root - this synergyc runs on the
# login screen. IMPORTANT: I've found that at boot time NAME LOOKUP does not
# YET work so you MUST use the server's IP ADDRESS otherwise synergyc will
# fail to connect and exit after a few seconds (--reconnect does not work):
# so the BUG REPORT/enhancement request would be to make --reconnect work so
# that it never/ever exits synergyc - even if name lookup does not work, or
# if there is no display, etc.. As a (bad) alternative you can also use: 
# (sleep 10; /usr/bin/synergyc YOUR_SERVER_HOSTNAME) &
# NOTE: I've also found that sometimes you need to kill synergyc with -9
/usr/bin/killall -9 synergyc 
sleep 1 
/usr/bin/synergyc YOUR_SERVER_IP

/etc/gdm/PostLogin/Default:
# this script needs to kill the root synergyc started by Init/Default
/usr/bin/killall synergyc 
sleep 1 

/etc/gdm/Xsession:
# this script will start the user synergyc - the one that runs after you have logged in 
# Note: here you can also use your server's hostname, instead of the IP
/usr/bin/killall synergyc # no need, I guess?
sleep 1 
/usr/bin/synergyc YOUR_SERVER_IP

I took a different approach - wrote a script to start/stop synergyc.

I changed my scripts as follows:

# end of file, before exit 0
/etc/gdm/Init/Default:# SYNERGY BEGIN
/etc/gdm/Init/Default:# start synergy as root user (login screen)
/etc/gdm/Init/Default:/usr/local/bin/synergyc-ctl.sh start
/etc/gdm/Init/Default:# SYNERGY END

# top of file, after comments
# For at least CentOS 6.2, this needs to be in /etc/gdm/PreSession/Default
/etc/gdm/PostLogin/Default:# SYNERGY BEGIN
/etc/gdm/PostLogin/Default:# stop root synergy (login screen)
/etc/gdm/PostLogin/Default:/usr/local/bin/synergyc-ctl.sh stop
/etc/gdm/PostLogin/Default:# SYNERGY END

# top of file, after comments
/etc/gdm/Xsession:# SYNERGY BEGIN
/etc/gdm/Xsession:# start synergy as login user
/etc/gdm/Xsession:/usr/local/bin/synergyc-ctl.sh start
/etc/gdm/Xsession:# SYNERGY END

Here's also /usr/local/bin/synergyc-ctl.sh:

Here is an updated version of this script which includes support for setting crypto, display, logs, screenname.

#!/bin/sh
OP=${1}

# put the synergy server IP here (at boot time name lookup does not work
# and synergyc will fail and exit, using the IP prevents the problem)
SERVER_IP=192.168.1.10

SYNERGYC=/usr/bin/synergyc
PS=/bin/ps
GREP=/bin/grep
WC=/usr/bin/wc
PIDOF=/sbin/pidof
SLEEP=/bin/sleep

# check synergyc is running
function sc_check
{
  N=`${PS} -ef | ${GREP} "${SYNERGYC}"  | ${GREP} -v "${GREP}" | ${WC} -l`
  return $N
}

# kill synergyc if running
function sc_kill
{
  SIG=""
  while true
  do
    sc_check
    if [ $? -eq 1 ]
    then
      PIDS=`${PIDOF} "${SYNERGYC}"`
      if [ ${PIDS} != "" ]
      then
        kill ${SIG} ${PIDS}
      fi
    else
      break
    fi

    ${SLEEP} 1
    SIG="-9"
  done
}

# start synergyc
function sc_start
{
  while true
  do
    ${SYNERGYC} "${SERVER_IP}"

    ${SLEEP} 2

    sc_check
    if [ $? -eq 1 ]
    then
      break
    fi
  done
}

case "${OP}" in
  start)
    sc_kill
    sc_start
  ;;
  stop)
    sc_kill
  ;;
  *)
    echo "usage: synergyc-ctl [start|stop]"
    exit 1
  ;;
esac

exit 0

You can also simply put the command to start synergy as a daemon in ~/.xinitrc, though this won't give you the fine-grained control of a startup script.

 tinywm

Raspberry Pi

Here are some resources a handy user provided to help get this working in Raspbian: https://learn.adafruit.com/synergy-on-raspberry-pi/setup-synergy-client-autostart http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html

Clone this wiki locally