Customizing job processing for a user on UNIX® workstations - .jobmanrc
About this task
On UNIX® workstations, the local configuration script .jobmanrc permits users to establish a required environment when processing their own jobs. Unlike the jobmanrc script, the .jobmanrc script can be customized to perform different actions for different users. Each user defined as tws_user can customize in the home directory the .jobmanrc script to perform pre- and post-processing actions. The .jobmanrc script is an extra step that occurs before the job is actually launched.
- The standard configuration script,
jobmanrc
, is installed, and the environment variable LOCAL_RC_OK is set to yes (see Variables defined by default in the jobmanrc file). - If the file
TWS_home/localrc.allow
exists, the user's name must appear in the file. If theTWS_home/localrc.allow
file does not exist, the user's name must not appear in the file,TWS_home/localrc.deny
. If neither of these files exists, the user is permitted to use a local configuration script. - The local configuration script is installed in the user's home directory
(
USER_home/.jobmanrc
), and it has execute permission.
- Use eval if you want to launch a command.
- Use either eval or exec if you want to launch a script that does not need post processing activities.
- Use eval if you want to launch a script that requires post processing activities.
jobmanrc
, which runs your
local configuration script as follows:
$EXECIT $USE_SHELL $USER_home/.jobmanrc "$UNISON_JCL" $IS_COMMAND
where: - The value of USE_SHELL is set to the value of the
jobmanrc
SHELL_TYPE variable (see Variables defined by default in the jobmanrc file). - IS_COMMAND is set to yes if the job was scheduled or submitted in production using submit docommand.
- EXECIT is set to exec if the variable USE_EXEC is set to yes (see Variables defined by default in the jobmanrc file), otherwise it is null.
All the variables exported into jobmanrc are available in the .jobmanrc shell, however, variables that are defined, but not exported, are not available.
#!/bin/ksh
PATH=TWS_home:TWS_home/bin:$PATH
export PATH
/bin/sh -c "$UNISON_JCL"
.jobmanrc
that does processing
based on the exit code of the user's job: #!/bin/sh
#
PATH=TWS_home:TWS_home/bin:$PATH
export PATH
/bin/sh -c "$UNISON_JCL"
#or use eval "$UNISON_JCL" and the quotes are required
RETVAL=$?
if [ $RETVAL -eq 1 ]
then
echo "Exit code 1 - Non Fatal Error"
exit 0
elif [ $RETVAL -gt 1 -a $RETVAL -lt 100 ]
then
conman "tellop This is a database error - page the dba"
elif [ $RETVAL -ge 100 ]
then
conman "tellop Job aborted. Please page the admin"
fi
126
displaying error
"script.sh: cannot execute [Text file
busy]
", and .jobmanrc
is used, add the
following:eval $JCL
stat=$?
if [ $stat -eq 126 ]
then
echo "JOB ERROR: The command $JCL ended with error 126."
echo "JOB ERROR: try the workaround"
echo running ksh $JCL
ksh $JCL
stat=$?
if [ $stat -eq 126 ]
then
echo "#!/bin/ksh" > $HOME/tmp.$$.sh
echo $JCL >> $HOME/tmp.$$.sh
chmod +x $HOME/tmp.$$.sh
echo running ksh $HOME/tmp.$$.sh
ksh $HOME/tmp.$$.sh
stat=$?
rm $HOME/tmp.$$.sh
else
echo "JOB OK: using workaround 1, exit code=$stat"
fi
fi
echo rc $stat
exit $stat