IBM Support

Configuring TWS (Unix) to send email when a job abends

Question & Answer


Question

Can Tivoli Workload Scheduler (TWS) be configured to send email when a job abends on a UNIX agent?

Answer

This can be achieved by modifying jobmanrc or modifying/creating .jobmanrc (note that the filename of jobmanrc is preceded by a period "."). These solutions must be implemented on each agent that must send out emails when jobs abend.

jobmanrc:

The jobmanrc solution applies to any TWS job that abends on the agent where it has been configured.


1. Edit TWSHome/jobmanrc

Example
:
#!/bin/sh -x
#@(#) $Id: jobmanrc.sh,v 9.9 1999/05/06 21:56:07 pl Exp $
#
# This script is invoked by jobman when launching a job. The job's
# script file is $1

..

..

2. Proceed to MAIL_ON_ABEND section and change MAIL_ON_ABEND="NO" to MAIL_ON_ABEND="YES".

Setting it to "YES" will cause email to be sent to logon user of job that abends. A different or additional user or users can also be specified. If the TWS user is also to receive the email edit MAIL_ON_ABEND="$LOGNAME, maestro". The keyword "$LOGNAME: is the exact syntax to enter and is case sensitive. TWS will interpret this as the logon user for the job. The user maestro is the TWS user and it will also receive an email. If additional users are to also receive the email they can be added, each user must be separated by a comma.

NOTE: This setting means that all users that are specified will receive an email any time a TWS job abends on this local CPU.


# VARIABLE : MAIL_ON_ABEND
#
# MAIL_ON_ABEND is used to cause a message to be mailed when a job
# fails to run correctly (returns a nonzero exit code). Setting
# MAIL_ON_ABEND to "YES" will cause a message to be mailed to the
# mailbox for the logon user. This message will indicate the name of
# the stdlist file to be examined to determine the cause of the
# failure. Setting it to "NO" will skip the mail step. Any other
# value will be considered to be a user id to mail output to. A list
# could be specified if several users should be notified.
#
# DEFAULT : "NO"
# CRON Equivalent : "YES"
MAIL_ON_ABEND="NO"
..
..

3. An email will be sent to the logon user of the job. This means that anytime a job abends on this local CPU, TWS will send an email to the logon user of the job.

.jobmanrc:


The .jobmanrc solutionapplies to abended TWS jobs for a specific user.


1. Create a .jobmanrc file as outlined inTWS v8.2 Planning and Installation Guide ("Using the configuration scripts"), Chapter 3 of the TWS v8.3 or TWS v8.4 Reference Guide or Chapter 3 of theTWS v8.5 User's Guide and Reference ("Configuring the job environment").

2. Using the example provided in the Reference guide (see below) add the following syntax when the error code is not zero. This syntax will send an email to the logon users jobs abend.



Below is a TWS 8.1 sample .jobmanrc section for nonzero exit code. The example syntax must be the last entry in the .jobmanrc:



Below is a TWS sample .jobmanrc section for nonzero exit code. The example syntax must be the last entry in the .jobmanrc:


Sample .jobmanrc code

[{"Product":{"code":"SSGSPN","label":"IBM Workload Scheduler"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"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"}}]

Product Synonym

Maestro;TWS;IWS;TWA

Document Information

Modified date:
17 June 2018

UID

swg21165731