![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare date | vanand420 | Shell Programming and Scripting | 7 | 05-29-2009 11:32 AM |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 9 | 12-01-2008 11:37 PM |
| compare files in the system with last modified date | bsandeep_80 | Linux | 6 | 01-15-2008 12:56 AM |
| compare date with date in file | siog | UNIX for Dummies Questions & Answers | 2 | 10-04-2006 01:10 PM |
| compare today's date with date in a file | siog | UNIX for Dummies Questions & Answers | 4 | 10-04-2006 12:55 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|