[ale] bash question

Greg Freemyer greg.freemyer at gmail.com
Mon Apr 30 19:20:41 EDT 2007


Never mind,

I happened into a way to test it.  I had to move the assignment of NOW
after the test of $?, but then it seems to work.

I'll know for sure in a couple of days.  (ie. it is my nightly backup
script and I'm getting plenty of timeouts to do real world testing.
They just take hours per iteration.)

Greg

On 4/30/07, Greg Freemyer <greg.freemyer at gmail.com> wrote:
> All,
>
> I'm experiencing rsync timeouts, so I want to keep invoking it
> repeatedly until it either finishes or 3 hours have gone by.  When it
> times out the return code is 30.
>
> I'm thinking this might work, but I don't have a great way to test it.
>  So could a couple bash experts review it.  I've tried it and at least
> I don't seem to have any syntax errors.
>
> Also, I tested the for loop logic with a simple sleep and it worked.
> It is the break logic I can't test easily.
>
> ===
> #!/bin/bash
>
> START=`date +%s`
> MAX_TIME='10800'   # number of seconds in 3 hours
>
> for (( DELTA=0 ; DELTA < MAX_TIME; DELTA = NOW - START))
> do
>         rsync -a
> --partial-dir=/home/forensic1000/forensic1000/transfer ... [Lots more
> args]
>         NOW=`date +%s`
>         if [ $? != 30 ]
>         then
>             break;
>         fi
> done
> ===
>
> Thanks
> Greg
> --
> Greg Freemyer
> The Norcross Group
> Forensics for the 21st Century
>


-- 
Greg Freemyer
The Norcross Group
Forensics for the 21st Century



More information about the Ale mailing list