Let's pretend I have something like this (forgive the bad perl style - this is Someone Else's Perl.)
#!/usr/bin/perl
my $config_dir = '/var/config';
my $status_file = 'last_update.status';
my $host = shift;
chomp($host);
unless ( $host ) { die "Usage: $0 <hostname>\n"; }
open(STATUS,">$config_dir/$host/$status_file") or die "Could not open $config_dir/$host/$status_file for writing. Aborting...\n";
print STATUS time() . "\n";
close(STATUS);
It's invoked via commandline like so update_status.pl foo
.
What I expect to happen: /var/config/foo/last_update.status contains a current timestamp.
What actually happens: /var/config/foo/last_update.status contains an old timestamp.
Now, the script doesn't die; it completes successfully and returns exit code 0 to bash. This is a Debian Linux box running perl 5.10.1.
So my question is: how can I inspect STATUS
? Data::Dumper is not helpful at all.
Thanks.
You sort of already inspected it, in that it is not dying.
It could be that your filesystem has timestamp modification tracking disabled. Look at the output of the mount command, and look at the options on the filesystem.
If you meant the content of the file is wrong (as opposed to the inode mtime), then I'd suggest that perhaps your system time is off or perhaps your timezone environment is different than you expect.