[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Monitor ctime on directory
From: |
Andreas Falck |
Subject: |
Monitor ctime on directory |
Date: |
5 Aug 2004 06:46:57 -0700 |
Hi,
I would like to monitor a directory with respect to changes. The
directory is supposed to receive files regularly on incoming ftp, and
(I assume) that when the directory's ctime gets old (e.g. >1hr),
something is wrong. How do I express this in cfengine?
Using perl, I would write something like below, but I would prefer
using a pure cfengine expression if possible.
#!/usr/bin/perl
use strict;
use warnings;
my $dir = "/tmp/incoming";
my $lim = 60*60;
my $ctime = (stat($dir))[10];
my $diff = time() - $ctime;
print STDERR "warning: ".$dir." not changed last ".$lim." seconds\n"
if ($diff > $lim);
__END__
--
Andreas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Monitor ctime on directory,
Andreas Falck <=