[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Re: Help with a bash script please



On 14.01.2011 11:37, Adrian Levi wrote:
I have (hopefully) taken on everybody's suggestions, Here is the
current script :)


#!/bin/sh

# Variables:
# Determine backup level
incrementalfile="/srv/tar_incremental_file"

if [ -f $incrementalfile ]
then
backuplevel="date +%w"

you want:
backuplevel="`date +%w`"
or:
backuplevel="$(date +%w)"

else
backuplevel="0"
rm $incrementalfile>  /dev/null 2>&1
always quote file names with double quotes.
put a space before the redirection.

fi

zparameters="a -si -mhe=on -ppassword -t7z -m0=lzma -mx=9 -mfb=64
-md=32m -ms=on -l"
zfilename="Daily backup - $(date +"%a %h %H%M %d-%m-%Y").$backuplevel.tar.7z"
backuppath="/srv/allsocool /etc"
backupslocation="/srv/backups"

tarparameters="cf - --listed-incremental=$incrementalfile"


# cd to directory for output file
cd $backupslocation

quotes.

#tar $tarparameters $backuppath | 7z $zparameters $zfilename
quote path and filename.

tar $tarparameters $backuppath | 7z a -si test.tar.7z

quote path and filename.

[not read]

best regards

mart


Reply to: