IBM Support

Unix script runs interactively, but aborts under TWS

Troubleshooting


Problem

A Unix script runs fine interactively from a Unix command prompt, but does not run correctly when run under Tivoli Workload Scheduler (TWS) as a job.

Cause

This happens when the TWS environment does not have the correct variables or environmental settings. Either the jobmanrc or the .jobmanrc does not set the environment necessary for the script to run.

Resolving The Problem

Create and/or edit .jobmanrc to set the user's environment. To assist in determining what environment variables or settings are required for scripts, perform the following steps:


1. Logon as the user that jobs have issues launching scripts

2. Execute the following:

env > /tmp/userenv

3. While logged on as the same user execute conman

4. From within conman execute the following command specifying for logon the "username" of the user having problems executing scripts:

sbd env;logon=username

5. Compare the result of the env command that was created in step 2 to the job stdlist output from step 4. Whatever environment variables that exist in the output of step 2 must be available to TWS via .jobmanrc for scripts to launch.

NOTE: The .jobmanrc must exist in the home directory of the user for which the job will launch.

The .jobmanrc must also have execute permission for the owner and must not have any terminal settings or stanzas that require a reply. The following is a sample .jobmanrc:

***************************************************************


#!/bin/ksh
## Maestro user .jobmanrc
PATH=$HOME:$HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/bin/X11:/usr/local/bin:$HOME/bin:.
## Set up the shell environment

## Here are some common aliases, the following is optional
## Just an example of what can be done
alias ls='ls -F'
alias sj='conman sj'
alias sc='conman sc'
alias ss='conman ss'
alias v='conman status'
alias cds='cd $STDLIST'
alias ll='ls -l'

# Any application specific paths or variables like for
# Oracle may be included here also

# The following line is required and must be the last line of the
# .jobmanrc
/bin/sh -c "$UNISON_JCL"

[{"Product":{"code":"SSGSPN","label":"IBM Workload Scheduler"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF025","label":"Platform Independent"}],"Version":"8.4;8.5;8.5.1;8.6;9.1;9.2;9.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

1018783

Product Synonym

Maestro;TWS;IWS;TWA

Document Information

Modified date:
19 August 2020

UID

swg21155953