Hello,
I would like to run a perl script that sits on my win machine (client) on a unix server. I have putty/plink etc. setup where from a win command prompt I can execute any command on the unix server (using rsa keys for ssh authentication). I have the following in my perl script:
system("plink $server");
rest of my perl script
However, it does log in fine but does not execute the rest of the perl script.
Also how can I use perl to get the permissions on a file and print the same to a text file. This is my code:
chdir ($pathToCheck);
open theInputFile, $inputFile or die "Could not read from $inputFi
+le, program halting. \n";
open (theOutputFile, '>', $outputFile) or die "Could not open $out
+putFile. \n";
while (<theInputFile>)
{
chomp;
my $fileBeingChecked = "$_";
if (-e $fileBeingChecked)
{
#my $fileSize = -s $fileBeingChecked;
my $fileSize = stat($fileBeingChecked)->size;
my $date_string = ctime(stat($fileBeingChecked)->mtime);
print theOutputFile "Yes, $fileSize, $date_string \n";
}
else
{
print theOutputFile "No \n";
}
}
close (theOutputFile);
close (theInputFile);
I would like to add the permissions on the file - whether write or read etc. also to the theOutputFile.
Any suggestions ?