Hey can someone help me figure out why the value of $file_exists won't
change even when the file is mssing???? Thx.
#!/usr/bin/perl -w
$out="/home/laptop/scripts/perl/logs/resetmf.log";
open OUT, ">>$out" or die "Unable to open $out :$!";
@site=("Machine1","Machine2");
#telnet
use Net::Telnet;
$t = new Net::Telnet (Timeout=>10,
Errmode=>'die',
Prompt=>'/\$ $/i');
foreach (@site) {
$t->open($_);
$t->login('username','passwd');
print OUT scalar(localtime), " Conn EST: $_.\n";
$dir="pf/working/output/Channel_status";
@newdir=("/Machine1/$dir","/Machine2/$dir","/Machine9/$dir");
for($x=0; $x <= $#newdir; $x++) {
$file_exists = $t->cmd ("perl -e 'print 1 if (-s \"$newdir[$x]\")'") or
warn "Unable to execute: $!\n";
if ($file_exists) {
print "Found it\n";
}else{
print "File Missing\n";
}
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]