Hi All,
I´ve got the following problem
I´m implementing a failoverconcept. This requires to synchronize two files using ksh like this.
if HOST1:FILE1 is newer then HOST2:FILE1
THEN cp HOST1:FILE1 HOST2:FILE1
ELSE cp HOST2:FILE1 HOST1:FILE1
fi
How can I compare the files on two boxes?
I tried it on one box and it works
and im able to get the date information with ls -l and awk - like this but how i schould compare the datestrings or how can i change the variable format?
DATE_MAIN=`ls -l FILE1 | awk '$1 !~ /total/ { printf "%-32s \n",$8 ; }'`
DATE_BCKP=`rsh HOST2 ls -l FILE1 | awk '$1 !~ /total/ { printf "%-32s \n",$8 ; }'`
if [ $DATE_MAIN -ge $DATE_BCKP ]
THEN cp HOST1:FILE1 HOST2:FILE1
ELSE cp HOST2:FILE1 HOST1:FILE1
fi
An other idea i got was using the find command with the -newer flag but it didn´t work with an remote Host.
BRGDS & TIA
isacs
P.S.
Sorry for my poor english
