![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 8 | 04-24-2008 03:04 AM |
| compare files in the system with last modified date | bsandeep_80 | Linux | 6 | 01-14-2008 08:56 PM |
| compare date with date in file | siog | UNIX for Dummies Questions & Answers | 2 | 10-04-2006 09:10 AM |
| compare today's date with date in a file | siog | UNIX for Dummies Questions & Answers | 4 | 10-04-2006 08:55 AM |
| compare date | vanand420 | Shell Programming and Scripting | 5 | 09-01-2005 01:13 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|