I think what you need, is best done from your originating server, by sending a command that will execute remotely, to check the last modification time of
$remotefile
#!/usr/bin/perl -w
use strict;
my $remotefile = '/tmp/yourfile.conf';
my $remotestat = qx!
ssh -2 -p 12345 172.16.16.82 'perl -e "print ((stat(qq~$remotef
+ile~))[9])" '
!;
print "\n$remotestat \n";
print "\n", scalar localtime($remotestat), "\n\n";
If your ssh setup is working properly, this should return the value you need from the remote server. You might then keep a comparison table locally so if you determine the file was edited by someone other than your script you could then act accordingly..
I would just like to add though, that planning the whole thing architecturally - diagram it! - before writing the app will ultimately save you time.. then the code writing will become the final task. It will also be easier to document, and explain to users, management, etc
It also seems to me that to make your app a little closer to bulletproof you should consider keeping versioned backups of the remote files -- having multiple users jumping in to edit a single file at will with no change control or revisioning is kinda crazy.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.