#!/bin/sh ## ## SCRIPT: 00_rsync_bkup_2freeagentSeagate.sh in $HOME/Rsync ## ## PURPOSE: This script uses 'rsync' to backup data files ## (esp. home directory) --- to an external disk drive. ## ## HOW TO USE: Can make a desktop icon to run this script by ## simply clicking on the icon --- ## after the external disk drive is attached and ## running (powered up). ## ## (It is good to check the current size of the home directory to see if ## if fits on the external drive.) ## ## Reference: Linux Format Magazine #130, Apr 2010, p.105, Answers section ## ## 'rsync' only copies files that are different. With large files that ## have changed, it only copies the parts that have been altered. ## Its main parameters are a 'from' directory and a 'to' directory. ## ## The '--delete' option removes files not present on the first directory. ## The '--archive' option causes all file permissions and timestamps to be ## copied too. ## ## The trailing slashes on the directory names are important because they ## indicate that you want to sync the contents of the folders. If you omit ## them, you could end up copying one directory into another. ## ## Since we may be using an MS Windows FAT file system on the 'to' drive, ## we use '--modify-window=1', as explained here: ## --modify-window ## When comparing two timestamps, rsync treats the timestamps as ## being equal if they differ by no more than the modify-window ## value. This is normally 0 (for an exact match), but you may ## find it useful to set this to a larger value in some situations. ## In particular, when transferring to or from an MS Windows FAT ## filesystem (which represents times with a 2-second resolution), ## --modify-window=1 is useful (allowing times to differ by up to 1 ## second). ## ## Created: 2010oct21 ## Changed: 2010oct23 Added '$HOME/Rsync/start_sh_after_exe.sh' to hold ## the gnome-terminal open after the 'rsync' command runs. set -x ## FOR TESTING: (this works) # gnome-terminal -e "$HOME/Rsync/start_sh_after_exe.sh ls -al" # exit ## rsync --archive --delete /path/to/source/ /path/to/dest/ gnome-terminal -e "$HOME/Rsync/start_sh_after_exe.sh \ rsync --archive --delete -v --modify-window=1 \ /home/blaze/ /media/SEAGATEfreeagent/CyberpowerPC/home/blaze/" ## Could try -vv instead of -v. Could try -q instead of -v. set -