2014년 3월 9일 일요일

ubuntu에서 synergy 자동으로 실행하기

https://help.ubuntu.com/community/SynergyHowto#On%20the%20Client



Autostart Synergy before logging in (GDM)

Note: Autostarting Synergy before logging in requires that your network connection be available at all times and not just after you log in. This is accomplished by enabling the network connection for all users. To do this, choose System->Preference->Network Connections. Choose the network name and select Edit. Select "Available to all users", and then click "Apply". This connection will now be available at all times, including at the GDM login screen.
To make sure synergy is running at all times, the following has to happen: First, synergy is started when the GDM login screen starts. Then, synergy is killed and restarted when a user logs in. When the user logs out, synergy is killed and GDM starts it again. To edit system configuration files in the following sections open a text editor as the root user:
sudo gedit

On the Server

At the end of the file /etc/gdm/Init/Default, just before the line that says exit 0 add the following:
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergys with the following contents
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergys

On the Client

At the end of /etc/gdm/Init/Default, just before the line that says exit 0 add the following:
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
NOTE: If your system has been configured to login automatically, this step may cause ubuntu to hang right before going to the desktop. If this is the case, remove these lines from /etc/gdm/Init/Default and everything should work properly. If your system is hanging at this stage, you can hit CTRL-ALT-F1 to login through command line and edit this file.(Tested on 10.04LTS Lucid Lynx)
Add the following to the end of /etc/gdm/PostLogin/Default (create this file file if it does not already exist):
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/gdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergyc with the following contents
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
This will run synergyc when any user logs in. Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys. Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergyc

Autostart Synergy before logging in (KDM)

On the Client

Follow these steps to start the synergyc client when the KDM login screen launches.
Add the following to the end of /etc/kde3/kdm/Xsetup:
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc <SERVER HOSTNAME>
Be sure to replace <SERVER HOSTNAME> with the host name or IP address of the computer running synergys.
For the client file we must also edit the Xstartup script to kill our synergyc process running as root before the user Xsession scripts run. To do this add the following to the end of /etc/kde3/kdm/Xstartup and it should look like this:
# Xstartup - run as root before session starts

PATH="$PATH:/usr/bin/X11"

if [ -e /etc/nologin ]; then
  # always display the nologin message, if possible
  if [ -s /etc/nologin ] && which xmessage > /dev/null 2>&1; then
    xmessage -file /etc/nologin -geometry 640x480
  fi
  if [ "$(id -u)" != "0" ] && \
     ! grep -qs '^ignore-nologin' /etc/kde3/kdm/kdm.options; then
    exit 1
  fi
fi

# synergyc process, running as root, ends here. This is the last script in the gdm login sequence before things start running as user.
/usr/bin/killall synergyc
sleep 1

if grep -qs '^use-sessreg' /etc/kde3/kdm/kdm.options && \
   which sessreg > /dev/null 2>&1; then
      exec sessreg -a -l "$DISPLAY" -u /var/run/utmp \
                   -h "`echo $DISPLAY | cut -d: -f1`" "$USER"
      # NOTREACHED
fi

Autostart Synergy before logging in (LightDM)

On the client

Add the following line at the end of /etc/lightdm/lightdm.conf:
greeter-setup-script=/usr/bin/synergyc <SERVER HOSTNAME>
Where <SERVER HOSTNAME> is the name/IP of the server you are connecting to.

On the server

Add the following line at the end of /etc/lightdm/lightdm.conf:
greeter-setup-script=/usr/bin/synergys <CONFIG FILE>
Where <CONFIG FILE> is the path to your config file for synergy (see above for typical locations).

댓글 없음:

댓글 쓰기