[ale] bash question

Greg Freemyer greg.freemyer at gmail.com
Mon Apr 30 18:51:02 EDT 2007


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



More information about the Ale mailing list