pijush has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I want to execute a script on a remote UNIX box. Lets say this script will create an user in Oracle server ( which is in Unix box). I want my "rsh" implementation can handle all types of error. I have found out which types of error may arrive. These are:
#Get the machine OS $OS=$^O; if ($OS=~ /hpux/i) { $Command = "remsh" . " <MachineName>" . " <Command>"; } else { $Command = "rsh" . " <MachineName>" . " <Command>"; } #Creating temporary file $ErrorFile = "tmp".$$; $Error = 0xffff & system("($Command 2>$ErrorFile)"); # Open the error file and see if it has some contents if( open (fhError, "< $ErrorFile")) { while (<fhError>) { $ErrorText .= $_; } $Length = scalar(split(//,$ErrorText)); if($Length != 0 ) { print "Error occured during the execution of rsh command"; close (fhError); unlink ($ErrorFile); die "\n"; } else { close (fhError); } } unlink ($ErrorFile); if ($Error != 0 ) { die "Error occured during the execution of rsh command\n"; }
Is there any way to implement time out option?
Any help really appreciated.
Thanks in advance.
Regards
-Pijush
Edit, BazB: added formatting and code tags.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is there any way to implement timeout option with rsh?
by BazB (Priest) on Nov 26, 2003 at 14:11 UTC |