#! /bin/bash # Change next four values to suit your needs cd $HOME # get to home directory - it's where I do backups tarfilename=backup # Set defaults. These are the parameters to modify for filelistname=bin/backuplist # alternate behavior. full=1 # Assume full backup; adjust backup file list mod. date # # check for command line parameters. If any, assume the # first is the name of the backup tar file, and the # second the backup file list. Any value given for the # third parameter indicates an incrementall backup. # if [ $# -gt 0 ] # if the number of arguments is greater than 0, then # tarfilename=$1 # get the destination tar filename fi # Destination filename for backup is always first # if [ $# -gt 1 ] # if the number of arguments is greater than 1, then # filelistname=$2 # get the list of files to back up. fi # list of files to back up is always second # if [ $# -gt 2 ] # if the number of arguments is greater than 2, this is then # an incremental backup - don't touch backup list file. full=$3 # contents of full really doesn't matter - just change it. fi # # tar -cvf $tarfilename.tar -T $filelistname # create tarball $1 using file named $2, show tar progress gzip $tarfilename.tar # now compress it. set `date '+%m %d %y'` # get the date and format it. mv $tarfilename.tar.gz $tarfilename"_"$1"-"$2"-"$3".tar.gz" # insert current date into the gzipped tarball filename # leave it in the current directory to be copied onto CD if [ $full = 1 ] # then # check the full/incremental flag var=`which bu2` # get path to incremental backup script. touch $var # if full = 1 (not "inc" or anything else), then fi # set file modification date to current date # Now we're done.