OpenMediaVault  3.0 (Erasmus)
The open network attached storage solution
Public Member Functions | List of all members
OMV\System\Process Class Reference

Public Member Functions

 __construct ()
 
 setRedirect1toFile ($file)
 
 setRedirect2to1 ()
 
 setRedirect2toFile ($file)
 
 setInputFromFile ($file)
 
 setQuiet ($quiet=TRUE)
 
 setBackground ($background=TRUE)
 
 setEnv ($name, $value)
 
 getCommandLine ()
 
 execute (array &$output=NULL, &$exitStatus=NULL)
 

Constructor & Destructor Documentation

OMV\System\Process::__construct ( )

Constructor Example: $cmd = new ("ls -alh"); $cmd = new ("ls", "-al", "-h"); $cmd = new (array("ls", "-alh")); $cmd = new ("ls", array("-a", "-l", "-h"));

Member Function Documentation

OMV\System\Process::execute ( array &  $output = NULL,
$exitStatus = NULL 
)

Execute the command.

Parameters
outputIf the output argument is present, then the specified array will be filled with every line of output from the command.
exitStatusIf the argument is present along with the output argument, then the return status of the executed command will be written to this variable.
Returns
The last line from the result of the command.
Exceptions
OMV\System\Process::getCommandLine ( )

Get the command line to be executed.

Returns
The command line.
OMV\System\Process::setBackground (   $background = TRUE)

Execute the command in background. The method execute immediatelly returns in this case.

Parameters
backgroundSet to TRUE to do execute the command in background. Defaults to TRUE.
Returns
None.
OMV\System\Process::setEnv (   $name,
  $value 
)

Set an environment variable.

Parameters
nameThe name of the environment variable.
valueThe value of the environment variable.
Returns
None.
OMV\System\Process::setInputFromFile (   $file)

Accept input from a file. Set to FALSE to do not accept input from a file.

Parameters
fileThe file path.
Returns
None.
OMV\System\Process::setQuiet (   $quiet = TRUE)

Do not throw an error exception if the command execution fails.

Parameters
quietSet to TRUE to do not throw an exception. Defaults to TRUE.
Returns
None.
OMV\System\Process::setRedirect1toFile (   $file)

Redirect STDOUT to the given file. Set to FALSE to do not redirect STDOUT to a file.

Parameters
fileThe file path, e.g. '/tmp/xyz'.
Returns
None.
OMV\System\Process::setRedirect2to1 ( )

Redirect STDERR to STDOUT.

Returns
None.
OMV\System\Process::setRedirect2toFile (   $file)

Redirect STDERR to the given file. Set to FALSE to do not redirect STDERR to a file.

Parameters
fileThe file path, e.g. '/dev/null' or '&1'.
Returns
None.

The documentation for this class was generated from the following file: