If you mean stuff gets appended to the file or not, then you should try below code. It works by reading the file size, sleeping 30 min, reading the file size again and comparing the two values.
Quote:
not modified
It's also quite possible that the content of a file is changed, but the file size remains the same.
Obviously, in this case you cannot rely on the file size and should compare the modification times.
The code below can be easily adapted to do so.
Hint: You use the %Y format sequence in the stat command instead of %s (Check man stat or stat --help for details)
Hi,
I've got a question. How do I show the last updated time?
Whenever I do any of the following:
ls -l
ls -lu
ls -lt
I get the creation time.
I need the modification/last update time. I'm FTP'ing a file to a different server. I'd like to know when the FTP is completed. (2 Replies)
Hi,
I'm trying to accomplish the following and would like some suggestions or possible bash script examples that may work
I have a directory that has a list of log files that's periodically dumped from a script that is crontab that are rotated 4 generations. There will be a time stamp that is... (4 Replies)
hi all, i'm a student and managing lab at my insti. there in one application in which log file has to be maintaine the number of bytes transferred and received. but after certain entries these two attributes stop getting updated and holds same values for rest of the session. This happens one time... (4 Replies)
Hello Friends
I am facing a weird problem :confused:, we receive thousands of files in my system on a daily basis, access time stamp on some of the files are being updated as old time stamp like 1968-01-19, Could some one help me what could be causing this? so that i can narrow down the problem... (4 Replies)
Hi All,
I have a process which after some time continues move a files to some folder(say the name of the folder is logdir)
What i am trying to do is as the files are coming to the logdir folder, I want the latest updated time and date
of the folder in PERL. (1 Reply)
Hi ,
We have around 22 logs , each has different entries. I have to automate this using shell script. The ideas which am sharing is given below
1) We use only TAIL -100 <location and name of the log> Command to check the logs.
2) We want to check whether the log was updated before 24... (13 Replies)
Hi with the help of Gabriel canepa, i have just edited filename only in his code. The help which i got and he helped is
1) I have around 22 logs and each log should be updated in the last 24 hours from the current timestamp.
2) It should check for ERROR message (not error,Error) in the log and... (2 Replies)
Hello,
Iam running with one issue, since particular date looks like one of the script vanished from the system after restarting of the system.
I dont know which scrit it was but definatelt there should be one.
but might be some logs would be there which have not updated from that day.
so... (2 Replies)
I have a log file which have a date and time at the start of every line.
I need to search the log file starting from a specific time to the end of file.
For example:
Starting point: July 29 2018 21:00:00
End point : end of file
My concern is what if the pattern of `July 29 2018 21:00:00`... (3 Replies)
Discussion started by: erin00
3 Replies
LEARN ABOUT DEBIAN
path::class::file::stat
Path::Class::File::Stat(3pm) User Contributed Perl Documentation Path::Class::File::Stat(3pm)NAME
Path::Class::File::Stat - cache and compare stat() calls on a Path::Class::File object
SYNOPSIS
use Path::Class::File::Stat;
my $file = Path::Class::File::Stat->new('path','to','file');
# $file has all the magic of Path::Class::File
# sometime later
if ($file->changed)
{
# do something provocative
}
DESCRIPTION
Path::Class::File::Stat is a simple extension of Path::Class::File. Path::Class::File::Stat is useful in long-running programs (as under
mod_perl) where you might have a file handle opened and want to check if the underlying file has changed.
METHODS
Path::Class::File::Stat extends Path::Class::File objects in the following ways.
use_md5
Calling this method will attempt to load Digest::MD5 and use that instead of stat() for creating file signatures. This is similar to how
File::Modified works.
changed
Returns the previously cached File::stat object if the file's device number and inode number have changed, or if the modification time or
size has changed.
Returns 0 (false) otherwise.
While File::Modified uses a MD5 signature of the stat() of a file to determine if the file has changed, changed() uses a simpler (and
probably more naive) algorithm. If you need a more sophisticated way of determining if a file has changed, use the restat() method and
compare the cached File::stat object it returns with the current File::stat object.
Example of your own changed() logic:
my $oldstat = $file->restat;
my $newstat = $file->stat;
# compare $oldstat and $newstat any way you like
Or just use File::Modified instead.
restat
Re-cache the File::stat object in the Path::Class::File::Stat object. Returns the previously cached File::stat object.
The changed() method calls this method internally if changed() is going to return true.
SEE ALSO
Path::Class, Path::Class::File, File::Signature, File::Modified
AUTHOR
Peter Karman, <karman@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Peter Karman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-01-28 Path::Class::File::Stat(3pm)