Open a PSL channel to a process.






command processor that interprets and executes command*Valid Values* 
the built-in command types OS or a valid user-defined command type 
Note: You cannot use PSL as the type parameter.


syntax of the submitted command


optional application instance against which command executes*Default* 
application instance that is the nearest ancestor of command


optional user name under which the process channel is opened*Default* 
user name under which the popen() function is called


optional password under which the process channel is opened*Default* 
password under which the popen() function is called


The popen() function spawns a process to execute a command of a defined type and returns a channel number which can then be used to read the command's output or write messages to the command. (See the PSL functions read() and write().) The popen() function returns -1 on error. 

The popen() function can be used to submit a command to run in the background. Sometimes a long-running process like a daemon may be better run in the background, but care should be taken when submitting commands in the background. 

Normally, when a command is executed by a parameter, or as a recovery action, it is executed in the foreground, and the parameter waits for the command script to finish before refreshing. This ensures that the recovery action is complete before the parameter is checked to see if an additional recovery action is required. 

However, if a recovery action is submitted in the background, the command script can finish before the recovery action is complete. When the command script finishes, the parameter refreshes. If the parameter is still in an alarm state, a second recovery action may start and conflict with the first recovery action.


The following PSL script uses the popen() function to open a process channel to the Unix shell command interpreter and then uses the write() function to submit a script to the command interpreter.

chan = popen("OS","/bin/sh");
if (chan_exists(chan))
write(chan,"/usr/local/myscript &");

Was this page helpful? Yes No Submitting... Thank you