Hi,

I wanna execute an external bash command but timeout if it's taking
longer than XX seconds. I've tried it like this:
eval {
        local $SIG{ALRM} = sub {die "alarm\n"};
        alarm $timeout;
        $test = `$sshpassPATH . " -p ".$clientpw." ssh root@".$ip." ".
$RemcksumPATH." ".$RemcksumPATH." > ".$ckCKSUMclt`;
        alarm 0;
      };

      if ($@) {
        die unless $@ eq "alarm\n";
        print "DEBUG: timed out\n";
      }
      else {
        print "DEBUG: didn't time out\n";
      }

      print "DEBUG: script continues...\n";

But in this case the script tells me
sshpass: Failed to run command: Permission denied
$sshpassPATH contains "./ssdpass" which is present and executable by
the current user and if i put that whole string in between `` into a
system() command, it executes just fine. What am i doing wrong? Also
do I need to be using the ``? What's happening with $test? Is this
required?

Thanks,
Ron


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to