Home  |  Linux  | Mysql  | PHP  | XML
From:ben perl Date:Tue Mar 16 21:05:29 2010
Subject:Re: running stats on a file
Hi Jim,

Thanks for the reply. This seem to work only if i am running perl on the
machine itself.

I am instead using expect to ssh into this machine and run stat command and
use the output from that command to check the output of that stat command.

Thanks,
-Ben



On Tue, Mar 16, 2010 at 1:31 PM, Jim Gibson <jimsgibson@gmail.com> wrote:

> On 3/16/10 Tue Mar 16, 2010 12:18 PM, "ben perl" <ben.perl3@gmail.com>
> scribbled:
>
> > Hi Everyone,
> >
> > I writing this program to check if a file is being touched (linux "touch"
> > command) every 25 seconds.I am using stat command on linux.
> >
> > For example(please check the bold),
> >
> > stat file
> > File: `file'
> > Size: 0 Blocks: 0 IO Block: 4096 regular empty
> > file
> > Device: 803h/2051d Inode: 164394 Links: 1
> > Access: (0666/-rw-rw-rw-) Uid: ( 0/ admin) Gid: ( 0/ root)
> > Access: 2010-03-16 12:09:03.000000000 -0700
> > Modify: 2010-03-16 12:09:03.000000000 -0700
> > Change: *2010-03-16 *12:09:03.000000000 -0700 <=
>
>
> >
> > I am just worried about the change attribute above from stat command. So
> ,
> > what i am trying to do convert 12:09:03(as in the example above) into
> > seconds and add 25 seconds and convert back into "hour:minutes:seconds"
> > format and check the values match.
>
> If you are writing a Perl program, you can use the Perl built-in stat
> function that returns 'last modify time' in seconds from the epoch
> (1/1/70:00:00:00 UTC), rather than the Linux stat command as above. That
> way, you can easily compare times numerically and not worry about
> converting
> between numerical and string forms. See 'perldoc -f stat' for details.
>
> There is also the -M file test operator that returns the age (difference
> between the time your program started and the time the file was modified)
> of
> any file in floating-point days (multiply by 86,400 to get age in seconds).
> See 'perldoc -f -X' for details.
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
Re: Lingua::Stem 0.83 module installation problem
Re: running stats on a file
Re: Any Good SCM tool to manage Perl Code locally
Lingua::Stem 0.83 module installation problem
Replacement in 3GB file



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants