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

Re: Help with a bash script please




On Jan 14, 2011 4:33 AM, "Adrian Levi" <adrian.levi@gmail.com> wrote:
>
> I have the following bash script and it fails at line 14 and 15
> (7zparameters= and 7zfilename=) I have tried everything i can think of
> to get it to work, the answer has to be simple but i can't figure it.
>
> This is going to be my new backup script, based on an earlier version
> that is very similar in functionality except I wasn't using tar, in
> that version.
>
> #!/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
>
> 7zparameters='a -si -mhe=on -ppassword -t7z -m0=lzma -mx=9 -mfb=64
> -md=32m -ms=on -l'
> 7zfilename='Daily backup - `date +%a" "%h" "%H%M"

Check your quotes. There might be other things but it looks like you're missing a tick after date. Also a decent IDE would make this pretty plain to you - I use vim.

> "%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 '$7zparameters' '$7zfilename'
>
> # Finally perform an rsync backup home nightly.
> rsync -avz /srv/allsocool/


Reply to: