Re: compare file dates across nodes

From: Frye, Matthew (Matthew.Frye@REXHEALTH.COM)
Date: Mon Aug 04 2003 - 18:38:35 EDT


Shawn,
        I used a convention similar to this example in a script I wrote to
monitor command histories...I find it to be quite useful and configurable.

#!/bin/ksh
localfile_time=$(istat $local_file | grep mod | awk {'print $6'})
remotefile_time=$($rsh $host istat $remote_file | grep mod | awk {'print
$6'} )

echo $localfile_time
echo $remotefile_time

if [[ "$localfile_time" != "$remotefile_time" ]] # optional, but this
if can help you to avoid a lot
then # of unnecessary work,
especially if you loop it
        rcp -p $remote_file new_remote # copy and preserve time stamp
        if [[ $local_file -nt new_remote ]] # or vice versa
        then
                'do as you like'
        else
                'yadda yadda'
        fi
else
        'don't bother with all that, possible do something else entirely'
fi

> ----- Original Message -----
> From: "Shawn Bierman" <BiermanS@METHODISTHEALTH.ORG>
> Newsgroups: bit.listserv.aix-l
> To: <aix-l@Princeton.EDU>
> Sent: Monday, August 04, 2003 10:21 AM
> Subject: compare file dates across nodes
>
>
> > Is it possible to script this function? I would like to get the date of
> a file on a remote node ( with rsh ) and compare it to the date of a file
> on my local box. If its newer than the local file then do something if
> not
> do something else...kind of thing.
> >
> > without having to do something like: rsh nf1n01en1 ls -l
> /mksysb_dir/bos.obj.nf1n01en1.31Jul03| awk '{print $6 $7}'
> >
> > which returns: Jul31
> >
> > is there a command that can get the date of a file and return it in
> numeric form or something?
> >
> > this is aix5.1
> >
> > -shawn
>



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:07 EDT