CogUtil::UnixRun - Perl extension for running unix commands and collecting the output into an array.
use CogUtil::UnixRun; @output = unix_run($cmd_to_run,$timeout_in_seconds);
This runs the specified command on the command line with a specified timeout in seconds.
This module consists of one subroutine unix_run($cmd,$timeout).
The sub unix_run() takes two arguments:
1) the string containing the command(s) you want to run.
2) the number of seconds before the processes are killed off.
The output from the commands are returned as the output of unix_run. The subroutine passes this output back as an array.
If the timeout limit is reached, then an erorr message is passed back as the output of the subroutine. All error messages begin with ``Error:'' and have some sort of useful description in them.
use CogUtil::UnixRun; my @response = unix_run(``/bin/ls'', 10);
Maytal Dahan maytal@tacc.utexas.edu Catherine Mills cmills@sdsc.edu Stephen Mock mock@sdsc.edu
Cog::lib::Cog::Globus::Job, Cog::lib::Cog::Globus::RSL, Cog::lib::Cog::Globus::Run, Cog::lib::Cog::Globus::URLCopy, Cog::lib::Cog::MDS::Search, Cog::lib::Cog::Security::Cacl, Cog::lib::Cog::Security::Myproxy, Cog::lib::Cog::Security::Proxy, Cog::src::Config, CogUtil::lib::CogUtil::Log, CogUtil::lib::CogUtil::UnixRun, Gridport::lib::Gridport::Authentication, Gridport::lib::Gridport::FileTransfer, Gridport::lib::Gridport::Job, Gridport::lib::Gridport::ProxyForward, Gridport::lib::Gridport::SRB, NWS::lib::NWS, SRB::lib::SRB
unix_run
Parameters:
command - this is the command to run on the command line
timeout - the timeout in seconds, the time for the command to run before it is killed.
Usage:
use CogUtil::UnixRun;
my @response = unix_run("echo hello", 10);
Returns:
An array with the command results