Autostart Synergy on Fedora Linux

Category: Note to Self

Synergy is a really useful piece of open source software that lets me share a single keyboard and mouse between multiple computers on my desk.

In my work environment my  Mac acts as ‘server’ (because this machine is rarely switched off) which shares its keyboard and mouse with my Linux development machine. Getting the synergy client to start automatically on the Linux box took me a while to work out, this is how I finally got it to work.

This works for me with Fedora 16 & KDE Desktop and is based on the info found here

I use 2 shell scripts to handle starting and stopping of the synergy client:

Shell script 1 – startSynergy.sh

#!/bin/sh
 
#Make sure any existing instances are shutdown
/usr/bin/killall -9 synergyc
sleep 1
#Start synergy - use your own IP
/usr/bin/synergyc 192.168.1.13
 
# This fixes a bug with synergy that causes @ to display as omega symbol
xmodmap -e "keycode 24 = q Q at at at at"

Shell script 2 – stopSynergy.sh

#!/bin/sh
#Stop synergy
/usr/bin/killall -9 synergyc

1. To have synergy startup after system boot, edit file /etc/gdm/Init/Default and add the line near bottom (before exit):

/path/to/script1/startSynergy.sh

2. After logging in, we should kill the current instance of synergy because it as running as root – to do this, edit (or create) file /etc/gdm/PostLogin/Default and add the line:

/path/to/script2/stopSynergy.sh

3. To start synergy after user has logged in place script 1 (or a symlink to it) in folder ~/.kde/Autostart

4. To have synergy stop once the user has logged out of a KDE session, place script 2 (or a symlink to it) in folder ~/.kde/shutdown

Mount or automount samba share

Category: Note to Self

Works with Fedora 16

From command line:

$ mount -t cifs -o user=lopez,password=mypassword  //192.168.1.13/path /mnt/share/mntpoint

If samba folder has a space in the name:

$ mount -t cifs -o user=lopez,password=mypassword  //192.168.1.13/"path with spaces" /mnt/share/mntpoint

Automount

edit /etc/fstab and add the following lines:

//192.168.1.13/my\path1 /mnt/share/mountpoint1  cifs  user=lopez,password=mypassword,uid=lopez,gid=users 0 0
//192.168.1.13//path\040space /mnt/share/mountpoint2  cifs  user=lopez,password=mypassword,uid=lopez,gid=users 0 0

(note use of \040 to escape space in fstab, rather than surrounding quotes used in command line)

Rsync examples

Category: Note to Self

To rsync between 2 hosts you should have a public key to allow password-free login

Example 1: Copy all files to remote folder

rsync -avz -e ssh /source/path/  remoteuser@remotehost.com:/remote/folder/

Example 2:  rsync operation deleting files on the remote side that do not exist on local:

rsync -azv --delete -e ssh /source/path/ remoteuser@remotehost.com:/remote/folder/

Example 3:  exclude specified files from operation

rsync -azv --delete -e --exclude 'Thumbs.db' --exclude '.DS_Store' /source/path/ /destination/folder/