Hi all,

My complete script should check /home/root/.ssh/authorized_keys,
look for patterns, cut them out, copy the product to directories
created if certain entries are in /etc/passwd and write a log.
Every run of the script creates a new entry
/var/tmp/scriptname/scriptname.numbers.numbers.log

The script is run by crontab in 10min intervalls.

I'd like my script to check whether /home/root/.ssh/authorized_keys
in the meantime (between crontab runs) and if yes execute the whole cycle.

All seems to work, except the part, where I want to check whether /home/root/.ssh/authorized_keys have changed in the meantime.

In this excerpt I wanted to compare the modification time of
/home/root/.ssh/authorized_keys to the modification time of
my log entries.
If one entry is older than the modified key, run the rest.

The problem here is, that (stat($n))[9] always gives me a number
smaller than (stat($root_auth_keys))[9])
I believe because this part here already updates
the mtime of (stat($root_auth_keys))[9]).

I don't want to use a file as trigger.

my $logdir = "path/to/logdir";
opendir(LOGDIR, $logdir) or die "Can't open $logdir\n";

while ($_ = readdir LOGDIR) {
        next if $_ =~ /^\./;
        $_ = "$logdir/$_";
        if ((stat($_))[9] > (stat($root_auth_keys))[9]) {
                print "stat: ", (stat($_))[9];                        #debug
                print "stat: ", (stat($root_auth_keys))[9];   #debug

I'd be very thankful for any input to solve this.

Kind regards,
lars.


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to