The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-12-2002
isacs isacs is offline
Registered User
  
 

Join Date: Mar 2002
Location: Muenster - Germany
Posts: 22
Question compare date of files on different nodes

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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0