Previous Topic: About xcomntfy

Next Topic: Requirements for SMTP Notifies


Sample Script

The supplied script uses mailx(1) to notify the named user logins.

The following is the xcomntfy script:

#!/bin/sh
# @(#)xcomntfy.sh    1.2    3/28/92 08:42:41
#   This procedure (xcomntfy) is called by CA XCOM Data Transport
#   transaction program when the NOTIFY parameter is set to YES.
#
#   The arguments passed to the xcomntfy procedure are:
#
#   -q q_entryname
#
#   -h how
#
#   The following $how will be treated as 'M' (mail to user) by default:
#       T - TSO;
#       R - ROSCOE;
#       C - CICS;
#       L - another LU;
#       M - mail to user.
#   The following $how will be treated as 'W' (write to user) by default:
#       W - write to user.
#   The following $how will be treated as 'A' (write to all users) by 
#   default:
#       A - all;
#
#   -u login
#
#   Note: 1.Other information about the transfer can be extracted
#       from the output of xcomqm -D$q_entryname command
#       for postprocessing
#         2.If specified in $how method fails, the mail message will be 
#       sent to $LOGNAME or root.

#uncomment following to diagnose problems with script
# set -xv

if [ `uname` = 'SunOS' ]
then MAIL=Mail
else
     MAIL=mailx
fi

# required for HPUX-10
if [ `uname` = 'HP-UX' ]
then PATH=/opt/xcom/bin:$PATH
fi

while test $# -gt 0
do
    case "$1" in
        -h)
            how="$2"
            shift;;
        -q)
            q_entryname="$2"
            shift;;
        -u)
            login="$2"
            shift;;
    esac
    shift
done
case "$how" in
    [TRCLMV]* )
        xcomqm -D$q_entryname|
        $MAIL -s "xfer $q_entryname" ${login:-${LOGNAME:-root}} 
>/dev/null 2>&1
        ;;
    [W]* )
        xcomqm -D$q_entryname|
        if [ "$login" != "" ]
        then
        (write $login || $MAIL -s "xfer $q_entryname" 
${login:-${LOGNAME:-root}})  >/dev/null 2>&1
        fi
        ;;
    [A]* )
        xcomqm -D$q_entryname|
        (wall || $MAIL -s "xfer $q_entryname" ${login:-${LOGNAME:-root}}) 
>/dev/null 2>&1
        ;;
    * )
        ;;
esac

# put user defined notification
# script here

exit 0