Syntax
string system( string command [, string input] )
Description
The system function runs the specified command on the policy server, taking input from and sending output to the users terminal. system can use an optional string parameter to pass an input string to a command instead of prompting the user for input.
system sets the status variable to the exit status of the command. Typically, the exit status of a command returns 0 if it is successful, and non-zero if it is not successful.
By default, the command runs as root, but you can set the subprocuser variable to a different user under which to run the command.
For security reasons, One Identity recommends that you set the second parameter to " " (empty quotation marks) for all system calls that do not require user input.
Example
#list the contents of the directory /etc - and store the result as a string in "files". #The exit status is stored in "status" and should be 0 if ls succeeds. files=system("/bin/ls /etc"); if (status == 0) { …}
#perform a NIS lookup for all known hosts and store the result in "hosts" variable. hosts=system("ypcat hosts"); if (status==0) {…}
#send mail to "root" user - the second param contains the contents of the mail, which #will be passed to the mail program as standard input. system("mail root", "mail from QPM4U\n");