This shows you the differences between two versions of the page.
|
indexes:backup_script_with_rsync [2010/02/09 10:07] domingo |
indexes:backup_script_with_rsync [2010/04/09 16:07] (current) domingo |
||
|---|---|---|---|
| Line 89: | Line 89: | ||
| tdd:x:1021:1021::/home/tdd:/usr/bin/rssh | tdd:x:1021:1021::/home/tdd:/usr/bin/rssh | ||
| </file> | </file> | ||
| + | |||
| + | ====== libnotify ====== | ||
| + | With a Ubuntu client you can use its notification framework to tell how the backup went. | ||
| + | |||
| + | Look at the following script: | ||
| + | <file> | ||
| + | #!/bin/bash | ||
| + | BACKUPLOG="/home/tdd/backup.log" | ||
| + | su tdd -c "/usr/bin/notify-send 'Backup Start...'" 2>&1 > $BACKUPLOG | ||
| + | |||
| + | rsync -avzgr --stats /home/tdd /boot /etc \ | ||
| + | --exclude="vmware/" \ | ||
| + | --exclude=".Trash" \ | ||
| + | --exclude=".Trash-1000" \ | ||
| + | --exclude="No-rsync-stuff" \ | ||
| + | --exclude=".VirtualBox/" \ | ||
| + | --exclude="enc-data*" \ | ||
| + | --exclude="dataspace" \ | ||
| + | --exclude="pagefile" \ | ||
| + | --exclude="samba" \ | ||
| + | --exclude="smb" \ | ||
| + | --exclude=".ICAClient/cache" \ | ||
| + | --exclude=".adobe/Flash_Player/AssetCache" \ | ||
| + | --exclude=".cache" \ | ||
| + | --exclude=".mozilla/firefox/*/Cache" \ | ||
| + | --exclude=".nx" \ | ||
| + | --exclude=".thumbnails" \ | ||
| + | --exclude=".gvfs" \ | ||
| + | --exclude="Downloads" \ | ||
| + | --exclude=".local/share/Trash" \ | ||
| + | --exclude=".evolution" \ | ||
| + | --exclude="tdd/Music" \ | ||
| + | tdd@172.21.1.1:/media/disk/backup 2>&1 > $BACKUPLOG | ||
| + | echo $? | ||
| + | if [ $? -eq 0 ] | ||
| + | then | ||
| + | NUMBEROFFILES=`grep "Number of files transferred" $BACKUPLOG |awk -F ':' '{print $2}'` | ||
| + | |||
| + | su tdd -c "DISPLAY=:0.0 /usr/bin/notify-send 'Backup Succesful Completed - $NUMBEROFFILES tranferred'" | ||
| + | else | ||
| + | su tdd -c "DISPLAY=:0.0 /usr/bin/notify-send 'Backup Failed...'" | ||
| + | fi | ||
| + | </file> | ||
| + | |||
| + | After running this script a notification is display on the screen telling either how many files were backup'ed or that it failed. | ||