My systems as performed: Ubuntu 10.04 Localhost, Debian 6.03 Remotehost
1) Configure your systems for an SSH public/private keypair (see ref: 1 below)
2) configure local user's bash environment: (see ref: 5)
edit ~/.bashrc and add this line:
xhost local:your_localuser > /dev/null
3) create rsync script:
#!/bin/bash # test if the ssh connection can be made ssh -q -i /directory_to_ssh_keys/your-rsync-key your_remotehost_user@your_remotehost_ip exit if [ $? = 0 ] then ((rsync -av --progress --omit-dir-times -e "ssh -i /directory_to_ssh_keys/your-rsync-key" "/your_local_directory/photos/" "your_remotehost_user@your_remotehost_ip:/your_remotehost_directory/familyphotos" | zenity --auto-kill --progress --pulsate --text="Wait while I sync the photo folder.. Don't move any photos or use Picassa ....") & #Start a loop testing if zenity is running, and if not kill rsync (see ref: 2) (RUNNING=0 while [ $RUNNING -eq 0 ] do if [ -z "$(pidof zenity)" ] then pkill -9 rsync RUNNING=1 fi done )) else zenity --warning --text "Backup server not available";echo $? fi
4) Create your crontab entry
using crontab -e, my example is an hourly sync:
# m h dom mon dow command
0 * * * * export DISPLAY=:0.0 && /directory_of _your_script/your_backup_script.sh
1. Secure your SSH server with Public/Private key authentification | Debian/Ubuntu Tips & Tricks
2. Bug #220656 in zenity (Ubuntu): “zenity --progress cancel button doesn't return a value”
3. Wget and zenity --progress - Page 2 - Ubuntu Forums
4. A complete zenity dialog examples 2 » Linux by Examples
6. HowTo make cron run GUI applications [Archive] - Ubuntu Forums
7. [all variants] Two-way synchronizing , rsync? - Ubuntu Forums
8. Do more backups - David Picard
Comments
Post new comment