Some PeopleSoft systems generate interfaces files that are then delivered to other systems by other shell scripts. These scripts may simply be initiated by the UNIX cron facility. The problem with this is that the scripts run irrespective of whether the PeopleSoft process that generated the interface file ran and completed successfully.
It is possible to use the Process Scheduler to run operating system commands, and to have those command interact appropriately with the generic Process Scheduler functionality.
Process Type Definition
First you need to create a new process type, I chose to call it ‘Shell Script’, that will run a named shell script, psft.sh. This wrapper script performs the interaction with the Process Scheduler and it in turn calls the script that is to be executed. The name of the database, the access ID and password, and the process instance are passed to the wrapper. Other parameters will be appended in the individual Process Definition.
Process Definition
It is necessary to create a Process Definition for each system command or script that is to be executed by the Process Scheduler. You could simply run the command directly from the Process Scheduler but then it could not be API aware, and the status in the Process Monitor will always be success when it script completes. When using the wrapper script, the API Aware check box should be checked.
The name of the script of system command and any parameters should be APPENDED to the command line defined in the Process Type definition, as shown below.
Wrapper Script (psft.sh)
This is the wrapper script that is specified in the Process Definition.
The newly defined Process can be run just as any other process is usually run. Any output from the script on the standard output channel is captured by the Process Scheduler and written to a logfile that can then be viewed from the View Log/Trace facility within Process Monitor.
Two files are shown in the Process Monitor.
• OTH_DMKTEST_1561.log is the standard output of the script that was captured by the Process Scheduler.
• dmktest.log is a file emitted by the called shell script dmktest.sh to the reporting directory.
Demonstration
This is the test script called by the Process Definition DMKTEST.
banner "HelloWorld" BASENAME=$(basename $0 .sh) if [ -d "${PSPRCSLOGDIR}" ] ; then echo "This script is running under Process Scheduler" cp $0 ${PSPRCSLOGDIR}/${BASENAME}.log else echo "This script is not running under Process Scheduler" fi exit $*
This is the standard output of the script found in file OTH_DMKTEST_1561.log
/usr/local/bin/psft.sh:/usr/local/bin//dmktest.sh 0 Mon 2 Jul 11:53:15 2007 Setting process request 1561 to status 7 # # # # # # ###### # # #### # # # #### ##### # ##### # # # # # # # # # # # # # # # # # ####### ##### # # # # # # # # # # # # # # # # # # # # # # # # # # ##### # # # # # # # # # # # # # # # # # # # # # # ###### ###### ###### #### ## ## #### # # ###### ##### This script is running under Process Scheduler Setting process request 1561 to status 9 Mon 2 Jul 11:53:16 2007
A more detailed version of this document can be found at http://www2.go-faster.co.uk/docs/process_scheduler_shell_scripts.pdf
Please not this blog is not a support site. Please do not use the comments to ask for support on this script, you can contact me directly. You will need a basic knowledge of Unix shell scripting to use this technique.