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

2011-01-14 Thread Boyd Stephen Smith Jr.
In <20110114120047.ga7...@hysteria.proulx.com>, Bob Proulx wrote: >Adrian Levi wrote: >> zparameters="a -mhe=on -pd1ckhead -t7z -m0=lzma -mx=9 -mfb=64 -md=32m >> -ms=on -si" zfilename="Daily Backup - $(date +"%a %h %H%M >> %d-%m-%Y").$backuplevel.tar.7z" > >Yuck! Look at all of those spaces in the

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

2011-01-14 Thread Boyd Stephen Smith Jr.
In <4d303ac4.2020...@chello.at>, Mart Frauenlob wrote: >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

Re: Help with a bash script please

2011-01-14 Thread Boyd Stephen Smith Jr.
In , Adrian Levi wrote: >backuplevel="0" # Quotes are redundant. 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" >"%d-%m-%Y`.$backuplevel.tar.7z'

Re: Help with a bash script please

2011-01-14 Thread shawn wilson
Oh yeah, and I think its better to put constants at the top of the file. Makes things easier imo. Also, chose better variable names. I figured out what they are based on how you used them but it should be the other way around - backupoath vs backuplocation - really? How about 'source' and 'dest'?

backup [was Re: Help with a bash script please]

2011-01-14 Thread Miles Fidelman
Jochen Schulz wrote: Adrian Levi: This is going to be my new backup script, I don't want to keep you from learning shell scripting, but I generally advise against scripting your own backup solution. From my experience the result is error prone, tends to attract feature creep and is ha

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

2011-01-14 Thread shawn wilson
No real help here, just some general comments. First, don't cd in a script. Use full paths - this includes defining paths to your programs (if you or someone else put a different program with the same name that is found earlier in your path, your script is liable to cause a big mess). Bash is nice

Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
On 14 January 2011 22:44, Mart Frauenlob wrote: ! > see also: > http://en.wikipedia.org/wiki/Unix_shell > http://en.wikipedia.org/wiki/Comparison_of_command_shells Thanks for the homework ;-) It works now BTW... Adrian -- 24x7x365 != 24x7x52 Stupid or bad maths? hm. I've lost a machine.. l

Re: Help with a bash script please

2011-01-14 Thread Mart Frauenlob
On 14.01.2011 13:11, Adrian Levi wrote: On 14 January 2011 21:51, Mart Frauenlob wrote: [...] Not sure exactly what bash (as compared to sh) specific things I might be experiencing but from the man page: "If bash is invoked with the name sh, it tries to mimic the startup behavior of histori

Re: Help with a bash script please

2011-01-14 Thread Mart Frauenlob
On 14.01.2011 13:11, Adrian Levi wrote: On 14 January 2011 21:51, Mart Frauenlob wrote: in debian lenny (and previous releases) the default shell aka sh is bash. the file /bin/sh is a symbolic link to /bin/bash. however in squeeze afaik the default shell is dash. so your script starting with t

Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
On 14 January 2011 21:51, Mart Frauenlob wrote: > in debian lenny (and previous releases) the default shell aka sh is bash. > the file /bin/sh is a symbolic link to /bin/bash. > however in squeeze afaik the default shell is dash. > so your script starting with the shebang #!/bin/sh will not be ru

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

2011-01-14 Thread Mart Frauenlob
On 14.01.2011 12:50, Adrian Levi wrote: I know where the error lies but not how to fix it. zparameters="a -mhe=on -pd1ckhead -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -si" zfilename="Daily Backup - $(date +"%a %h %H%M %d-%m-%Y").$backuplevel.tar.7z" When these two expand here: tar $tarparamet

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

2011-01-14 Thread Mart Frauenlob
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

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

2011-01-14 Thread Bob Proulx
Adrian Levi wrote: > zparameters="a -mhe=on -pd1ckhead -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on > -si" > zfilename="Daily Backup - $(date +"%a %h %H%M %d-%m-%Y").$backuplevel.tar.7z" Yuck! Look at all of those spaces in the filename! :-) (Recalling all of the discussion over the past couple o

Re: Help with a bash script please

2011-01-14 Thread Mart Frauenlob
On 14.01.2011 10:33, Adrian Levi 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

OT: Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
I know where the error lies but not how to fix it. zparameters="a -mhe=on -pd1ckhead -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -si" zfilename="Daily Backup - $(date +"%a %h %H%M %d-%m-%Y").$backuplevel.tar.7z" When these two expand here: tar $tarparameters $backuppath | 7z $zparameters $zfilena

Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
On 14 January 2011 20:32, Jochen Schulz wrote: > I don't want to keep you from learning shell scripting, but I generally > advise against scripting your own backup solution. From my experience > the result is error prone, tends to attract feature creep and is hard to > deploy to new environments.

OT: Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
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 zpa

Re: Help with a bash script please

2011-01-14 Thread Jochen Schulz
Adrian Levi: > > This is going to be my new backup script, I don't want to keep you from learning shell scripting, but I generally advise against scripting your own backup solution. From my experience the result is error prone, tends to attract feature creep and is hard to deploy to new environme

Re: Help with a bash script please

2011-01-14 Thread Adrian Levi
On 14 January 2011 19:46, Javier Barroso wrote: > variable names can't start with a number, I guess this is the fail. That was one, In all the material I read i didn't pick that one up. -- 24x7x365 != 24x7x52 Stupid or bad maths? hm. I've lost a machine.. literally _lost_. it responds to ping,

Re: Help with a bash script please

2011-01-14 Thread der.hans
Am 14. Jan, 2011 schwätzte Adrian Levi so: moin moin, 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. 7zparameters='a -si -mhe=on -ppas

Re: Help with a bash script please

2011-01-14 Thread Jochem Kossen
Hi Adrian, On 01/14/2011 10:33 AM, Adrian Levi 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 sc

Re: Help with a bash script please

2011-01-14 Thread Neil Youngman
On Friday 14 Jan 2011 09:41:34 shawn wilson wrote: > On Jan 14, 2011 4:33 AM, "Adrian Levi" 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

Re: Help with a bash script please

2011-01-14 Thread Javier Barroso
On Fri, Jan 14, 2011 at 10:46 AM, Javier Barroso wrote: > On Fri, Jan 14, 2011 at 10:33 AM, Adrian Levi 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 si

Re: Help with a bash script please

2011-01-14 Thread Javier Barroso
On Fri, Jan 14, 2011 at 10:33 AM, Adrian Levi 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. variable names can't start with a

Re: Help with a bash script please

2011-01-14 Thread shawn wilson
On Jan 14, 2011 4:33 AM, "Adrian Levi" 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 s