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

OT: Re: Help with a bash script please



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"
else
backuplevel="0"
rm $incrementalfile > /dev/null 2>&1
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

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

# Finally perform an rsync backup home nightly.
rsync -avz /srv/allsocool/ hostname:/srv/allsocool/

############################################################

All of the elements are on single lines,

Some testing indicatets that the remaining error is surrounding the 7z
command line.
the individual components seem to ecpand correctly:-

jupiter:~# echo "a -si -mhe=on -ppassword -t7z -m0=lzma -mx=9 -mfb=64
-md=32m -ms=on -l"
a -si -mhe=on -ppassword -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -l
jupiter:~# echo "Daily backup - $(date +"%a %h %H%M
%d-%m-%Y").$backuplevel.tar.7z"
Daily backup - Fri Jan 2039 14-01-2011..tar.7z
jupiter:~#

doing:-
tar $tarparameters $backuppath
results in copius material to console :-)
and the simple form of the 7z arguments works.

Adrian
-- 
24x7x365 != 24x7x52 Stupid or bad maths?
<erno> hm. I've lost a machine.. literally _lost_. it responds to
ping, it works completely, I just can't figure out where in my
apartment it is.


Reply to: