February Newsletter for Mt Xia Technical
Consulting Group
In
this issue:
- Upcoming Events
- Standardized Error Logging and Notification on
AIX
- Featured Shell Script
- eStorLink - guaranteed file transfer/delivery
tool
- Contact Info and URL's
- Additional URL's of Interest
UPCOMING EVENTS
Date: Feb 10 - 14,
2003
Transaction & Messaging: featuring the
CICS and MQSeries
product families - General information
Location: Las Vegas Hilton, Las Vegas,
Nevada
This leading conference will equip you
with the
transaction and messaging technical skills you need to
excel, extend your e-business applications and compete
in a world where change happens at a record pace.
Date: March 24 - 26,
2003
IBM Technical
Update
Location: Ostende,
Belgium
Methodologies, Procedures and
Standards
Standardized Error Logging and Error Notification
Described here is a technique which will allow an
organization to
consolidate their AIX error logging mechanisms and error notification
systems. This technique will also separate error logging from error
notification. The separation of error logging from error notification
will simplify the task of reporting errors from the operating system,
applications, programs, scripts, databases, etc. The separation of
error
logging will result in a standardized method of reporting errors from
all sources. The system or application administrator only needs to
know
how to report an error and does not need to consider how the
responsible parties will be notified of an error.
The error notification system may still contain several
mechanisms by which
notification is performed, but will be fed by the single consolidated
error
logging system. The error notification system will utilize a variety
of
mechanisms including e-mail, CONTROL-M, SuperVision, BMC Patrol,
etc.
The consolidation of the error notification systems into the
AIX error
logging will require the use of an error message template with
predefined data
records. These records may then be parsed by a subsequent shell
script or
program. The following records were identified which every error
message should
contain. This means that when a script encounters an error, each
record will be
a part of the error message sent to the "errlogger"
program: The fields within
each record are separated by the colon (:) character, the first field
is the
record identifier, the second field is the data. Sample data is shown
in the
example below:
Error Message Type: 0-TotalOutage|1-Critical|2-Urgent|3-Warning|4-Info
Error Notification Contact: Opensystems on-call|SAP on-call|...
Error Notification Time: Normal office hours|Immediate|Day Time Hours
Error Component Class: Hardware|Software
Error Component Name: AIX|OMS|EXE|Manugistics|Mercator|MQSeries|...
Error Return Code: 0-255
Error Label:
Error Description:
Error Email Address:
Supervision Group Name: opensys|sapsys|...
Error Message Type:This record provides
information regarding the
criticallity of the error. There are currently 5 levels defined and
should be
identified as follows:
- 0-TotalOutage
- 1-Critical
- 2-Urgent
- 3-Warning
- 4-Info
Error Notification Contact:The person, persons
or group to contact
regarding the error should be identified using this record type.
Examples
follow:
- Opensystems on-call
- SAP on-call
- Joe Schmoe
- John Doe, Jane Doe
Error Notification Time:When to contact the
person, persons, or group
who are responsible for resolving this error, should be defined using
this
record:
- Immediate
- Normal office hours
- Day time hours only
- Between 8:00am and 5:00pm weekdays
- Anytime
Error Component Class:Currently, only two
classes are defined:
"Hardware " and
"Software ". We may add other
classes as
needed such as "Firmware ".
Error Component Name:This record identifies the
failing component by
its common name. This name should be short and provide immediate
recognition of
the failed component such as:
- AIX
- OMS
- EXE
- Manugistics
- Mercator
- MQSeries
- Enterprise/CS
- CONTROL-M/Server
- CONTROL-M/Agent
Error Return Code:This is an arbitrary non-zero
positive number between
1-255. This is provided by the script writer or the exit code from a
compiled
program. If this code is not provided, it will be defaulted to
"1 ".
Error Label:A short description of the error.
This description should
be 64 characters or less and provide recogizable information
regarding the
error. It should not be a cryptic code of numbers and letters.
Error Description:This should be a detailed
description of the error
and provide specific information to the support personnel. The
support personnel
should be able to use the information provided in this description to
help debug
and diagnos the problem.
Error Email Address:This record is optional and
if defined, will cause
the error notification system to send an email message containing the
full text
of the error message, to all defined receipients. The data portion of
this
record should contain one or more valid email addresses.
Supervision Group Name:This record is optional
and if defined, will
cause the error notification system to attempt to send a shout
message to the
Supervision console in the Operations Center. The data portion of
this record
should the name of a predefined Supervision group. Currently, the
only valid
groups are:
- opensys:
Opensystems Group
- sapsys:
SAP Basis Group
If other Supervision groups are required, they will need to
be preconfigured
into the system. Dave Webster is the person responsible for
configuring these
groups.
The following 3 records are added to the error message
during the
notification phase. These do NOT need to be part of the error logging
phase:
Machine Class: RS/6000
Machine Type: $( lsattr -El sys0 -a modelname | awk '{ print $2}' )
Operating System: AIX $( oslevel )
The following is an example snippit of code to log an error
from a shell
script. This example would represent logging a "file system
full" error from one
of the OMS machines:
...blah...
...blah...
...blah...
errlogger "
Error Message Type: 1-Critical
Error Notification Contact: Opensystems on-call
Error Notification Time: Normal office hours
Error Component Class: Software
Error Component Name: AIX
Error Return Code: 1
Error Label: File system Full
Error Description: The file system /home is more than 90% full.
Please remove unneeded files or increase the size of the file system
to correct this problem.
Error Email Address: dfrench@mtxia.com
Supervision Group Name: opensys
"
...blah...
...blah...
...blah...
Notice that the system name and the date/time were
NOT
included in the error message. This is because the system name and
date/time are
automatically inserted with the message when it is added to the error
logging
system.
To configure the AIX Error Logging system, perform the
following steps.
- Create a file called
"
/tmp/operator.add " containing the
following Error Notification object:
errnotify:
en_label = OPMSG
en_type = TEMP
en_name = OPERATOR
en_class = "O"
en_method = "/home/bin/errnotify.ksh $1
$2 $3 $4 $5 $6 $7 $8 $9"
To add the object to the Error Notification object class,
enter:
odmadd /tmp/operator.add
The odmadd command adds the Error Notification object
contained in
"/tmp/operator.add " to the
errnotify file.
- To verify that the Error Notification object was added to
the object
class, enter:
odmget -q"en_name='OPERATOR'" errnotify
The odmget command locates the Error Notification object
within the
errnotify file that has an en_name value of "OPERATOR"
and displays the
object. The following output is returned:
errnotify:
en_pid = 0
en_name = "OPERATOR"
en_persistenceflg = 0
en_label = "OPMSG"
en_crcid = 0
en_class = "O"
en_type = "TEMP"
en_alertflg = ""
en_resource = ""
en_rtype = ""
en_rclass = ""
en_symptom = ""
en_method = "/home/bin/errnotify.ksh $1
$2 $3 $4 $5 $6 $7 $8 $9"
- To delete the OPERATOR Error Notification object from the
Error
Notification object class, enter:
odmdelete -q"en_name='OPERATOR'" -o errnotify
The odmdelete command locates the Error Notification
object within the
errnotify file that has an en_name value of "OPERATOR"
and removes it from the
Error Notification object class.
The error logging program is called
"/usr/bin/errlogger " and
will exist on every system. However, this program is normally
configured so that
only the "root" user can execute it. The permissions on
this program must be
changed to allow any user to execute it. Login as "root"
and change the
permissions as follows:
chmod 555 /usr/bin/errlogger
The following script is the error notification script. This
script performs a
number of different notification methods such as CONTROL-M,
Supervision, E-mail,
etc.
---- Cut Here ----
#!/bin/ksh
################################################################
#
# Program: errnotify.ksh
#
# Description: Accepts incoming error messages from the AIX
# Standard Error log and uses the Acme standard
# notification mechanisms to notify groups or
# individuals.
#
# Author: Dana French
#
# Date: 01/28/2002
#
################################################################
typeset -L10 JOBNAME
typeset -L50 DESCRIPTION
TMPSCRIPT="/tmp/ctmscript${$}.tmp"
TMPOUT="/tmp/tmp${$}.out"
################################################################
# Extract the full context of the error message from the
# AIX standard error log.
if errpt -a -l ${1} | sed -e "s/'/\\'/g" > ${TMPOUT}
then
################################################################
# Append the following information to the extracted error message.
print "Machine Class: RS/6000
Machine Type: $( lsattr -El sys0 -a modelname | awk '{ print $2}' )
Operating System: AIX $( oslevel )" >> ${TMPOUT}
chmod 666 ${TMPOUT}
else
print "ERROR: Unable to extract error message from AIX error
log" | tee /dev/console 1>&2
exit 1
fi
################################################################
# Parse the records defined in the error message and extract
# various bits of information. This information is used to
# describe the person or persons who should be contacted and when
# they should be contacted. It also provides a description of the
# error generated.
grep -i 'Node ID:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- NODEID
grep -i 'Error Notification Contact:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- DESCPART1
grep -i 'Error Notification Time:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- DESCPART2
grep -i 'Error Label:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- DESCPART3
grep -i 'Error Email Address:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- ERREMAIL
grep -i 'Supervision Group Name:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- SVGROUP
grep -i 'Error Component Name:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- COMPNAME
grep -i 'Error Return Code:' ${TMPOUT} |
awk -F: '{ print $2 }' |
read -r -- ERRORCODE
SHORTDESC="${NODEID}:ERR${$}:${DESCPART1}:${DESCPART2}:${DESCPART3}"
################################################################
# Create a shell script to print the content of the error
# message, remove itself, then exit with the error code
# from the program which generated the error.
if print "#!/bin/ksh
print -u2 -r -- '$( cat ${TMPOUT} )'
rm -f ${TMPSCRIPT}
exit ${ERRORCODE}" > "${TMPSCRIPT}"
then
chmod 777 "${TMPSCRIPT}"
else
print "ERROR: unable to create ${TMPSCRIPT}" | tee
/dev/console 1>&2
exit 2
fi
################################################################
# The ctmcreate parameters are defined here
export CONTROLM="/$( uname -n )/bmc/ctmagent/ctm"
CTMCREATE="${CONTROLM}/exe_AIX/ctmcreate"
MEMNAME=$( uname -n )_ERR${$}
GROUP="OPERATOR"
APPLICATION="ERRORS"
DATACENTER="FTW"
OWNER="root"
JOBNAME=JOB${$}
NODEGRP="$( uname -n )"
DESCRIPTION="${SHORTDESC}"
CMDLINE="/home/bin/ecsrun ${TMPSCRIPT}"
SHOUT="${SHORTDESC}"
SHOUT="TESTING ignore this message"
EXITCODE="0"
################################################################
# The ctmcreate command is executed here
${CTMCREATE} \
-tasktype COMMAND \
-group "${GROUP}" \
-application "${APPLICATION}" \
-nodegrp "${NODEGRP}" \
-memname ${MEMNAME} \
-jobname ${JOBNAME} \
-owner "${OWNER}" \
-description "${DESCRIPTION}" \
-shout NOTOK ECS R "${SHOUT}" \
-cmdline "${CMDLINE}"
STATUS="${?}"
################################################################
# If the Error Email Address record is defined, send the
# full content of the error message to the recipient defined.
if [[ "_${ERREMAIL}" != "_" ]]
then
mail -s "${SHORTDESC}" ${ERREMAIL} < ${TMPOUT}
fi
rm -f ${TMPOUT}
exit 0
---- Cut Here ----
FEATURED SHELL SCRIPT
eStorLink (pronounced
"ester-link"):
http://www.mtxia.com/fancyIndex/Tools/UUCP/eStorLink/
A guaranteed file transfer mechanism which could be used as a
replacement for MQSeries in certain circumstances. If your
organization
uses MQSeries as a reliable file transfer mechanism, then
"eStorLink" is
a free replacement for this function. eStorLink utilizes a
tried-and-true network protocol called "UUCP", which stands
for
Unix-to-Unix CoPy. However, don't let the name mislead your, UUCP
has
been ported to numerous platforms other than Unix. eStorLink provides
file delivery reports, and utilizes UUCP's automated fail-over
capabilities in the event of network outages.
eStorLink's only prerequisite is an operational UUCP network
which may
be over an existing LAN/WAN environment and can incorporate dial-up
connections for network connection redundancy. eStorLink is simply a
shell script with numerous options. To use eStorLink, just run the
shell script and specifiy your desired file transfer options. For
help
with available options, run "estorlink.sh -?".
What is
eStorLink?
- A tool to automate file movement between applications
on a heterogeneous or homogeneous network
- A tool with automated fail-over communications
support
- A tool to automate printer management on a heterogeneous
or homogeneous network
- A product for retailers who have remote sites that require
an integrated, no-worry communication system.
- A solution that automates file movement, controls data,
and manages with integrity no matter how large your
network may be.
eStorLink can provide an efficient, automated communication
system for a
widely distributed network. eStorLink utilizes tried-and-true
communications technology which has been in continuous operation for
over 30 years. Automated fail-over can be implemented to provide
redundant communication paths. As many redundant paths can be
implemented as desired each utilizing a different communication
mechanism and/or protocol.
Who uses
eStorLink?
- eStorLink can be used with hundreds of
locations or as few as two.
- eStorLink can be used with complex
dedicated networks or simple dial
networks.
- Anybody who need to communicate with
multiple machines in a reliable manner
is a eStorLink candidate.
What are the benefits of
eStorLink?
- Relieves applications of their data
movement responsibilities and accomplishes
these tasks itself.
- Works so you don't have to redesign the network
every time you add a new application
- Once installed, it runs so efficiently and
"quietly",
you may forget it's even there!
- Redundant Communication Paths
- Selectable Communication Mechanisms and
Protocols
What are the basic features of
eStorLink?
- Insulates applications from the network.
- Eliminates scripting of network functionality.
- Enables application-to-application messaging.
- Allows immediate and selectable transmission of
files based on user-defined data.
Host & Store platforms supported by
eStorLink?
- Any brand of Unix
- Linux
- Windows NT
- Others can be supported on a case-by-case basis
Protocol, access and
security
- Protocol
- Access
- Web Browser and Character based interfaces
- Security
- Unix Based security which can be customized
to fit each site.
Data Management Capabilities at the
store.
- Monitors status of data moving
between stores and headquarters.
- Prioritizes data transfer.
- Pre-processes and compresses files
before transfer.
- Automatically transfers store files to
headquarters.
Components
- The eStorLink utility
- Used to initiate a transfer request between
two locations. Send and/or receive
capabilities.
- Interfaces
- Web and character based. Used to view
and categorize log files.
Services
- Application Status
- Service Status
- Request Journal
- Call Manager
- Call Schedules
- Remote Systems
- System Groups
- Application Profiles
- System Values
- File Finder
---- Cut Here ----
#!/bin/ksh
#############################################################
# Program: eStorLink.sh
#
# Description: Unix-to-Unix connection program.
# This program provides end-to-end communication
# functions with confirmations
#
# Author: Dana French (dfrench@mtxia.com)
# Applied Intelligence Group
# (405) 936-2342
# Copyright 1999
#
# Date: 05/24/99
#
#############################################################
# Modifications:
#
b# 05/24/99 Original code Version: 1.0
#############################################################
rcommand()
{
echo "${1}" | tee -a "${UU_OUTPUT_FILE}"
}
#############################################################
lcommand()
{
rcommand "echo \"${1}\" >>
/tmp/eStorLink\${$}.tmp"
}
#############################################################
lcomment()
{
rcommand "echo \"#
\${TIMESTAMP}|\${UU_LOCAL_UUNAME}|\${UU_LOCAL_DIR}/\${UU_LOCAL_FNAME}|\${UU_REMOTE_UUNAME}|\${UU_REMOTE_DIR}/${UU_REMOTE_FNAME}|\${UU_NOTIFY_USER}|\${UU_OVERWRITE}|\${UU_SENDNOW}|\${UU_CURRENT_UUNAME}|${1}\"
| tee -a \${UU_LOGFILE} >> /tmp/eStorLink\${$}.tmp"
}
#############################################################
rcomment()
{
rcommand "echo \"#
\${TIMESTAMP}|\${UU_LOCAL_UUNAME}|\${UU_LOCAL_DIR}/\${UU_LOCAL_FNAME}|\${UU_REMOTE_UUNAME}|\${UU_REMOTE_DIR}/${UU_REMOTE_FNAME}|\${UU_NOTIFY_USER}|\${UU_OVERWRITE}|\${UU_SENDNOW}|\${UU_CURRENT_UUNAME}|${1}\"
>> \${UU_LOGFILE}"
}
#############################################################
llogfile()
{
lcommand "echo \\\"#
\\\${TIMESTAMP}|\\\${UU_REMOTE_UUNAME}|\\\${UU_REMOTE_DIR}/\\\${UU_REMOTE_FNAME}|\\\${UU_LOCAL_UUNAME}|\\\${UU_LOCAL_DIR}/\\\${UU_LOCAL_FNAME}|\\\${UU_NOTIFY_USER}|\\\${UU_OVERWRITE}|\\\${UU_SENDNOW}|\\\${UU_CURRENT_UUNAME}|${1}\\\"
>> \\\${UU_LOGFILE}"
}
################################################################
usage()
{
cat << _END_
Usage:
estorlink.sh -l localfile -r remotefile ( -g host | -p host ) [-o]
[-a transmit|confirm|hold|receive]
[-f file|print|mail|news]
[-b ascii|binary]
[-c comment]
[-t now|##:##|date/time]
Options are:
-l localfile : Full path name of local file
-r remotefile : Full path name of remote file
-m email : Email address of person to notify upon completion
-g A:B:C : List of hosts from which to "get" a file
-p A:B:C : List of host on which to "put" a file
-a action : Action of this command. Choices are:
transmit
hold
confirm
receive
-f function : Function of this command. Choices are:
file
print
mail
news
-b type : Type of this command. Choices are:
ascii
binary
-o : If destination file exists, overwrite it.
-t : Send now
( default is spool and wait for cron )
-h : Print this info text
Version 1.0: May 25, 1999
_END_
exit 1
}
################################################################
TIMESTAMP=`date +"%Y%m%d%H%M%S"`
DEV_NULL=/dev/null
UU_PROGRAMID="pgm2035" # (program ID number)
UU_OUTPUT_TYPE="${UU_OUTPUT_TYPE:-log}" # (Type of
output to display to user)
UU_ACTION="${UU_ACTION:-transmit}" # (Action to perform
on this file at the origination site)
UU_FUNCTION="${UU_FUNCTION:-file}" # (Function of the
file to be transfered)
UU_TYPE="${UU_TYPE:-ascii}" # (type of file
transfer mechanism to use with this file)
UU_SENDNOW="0" # (0=do-not-send-now 1=send-now)
UU_LOCAL_UUNAME="`uname -n`"
UU_LOCAL_UUNAME="${UU_LOCAL_UUNAME%%.*}"
UU_CURRENT_UUNAME="`uname -n`"
UU_CURRENT_UUNAME="${UU_CURRENT_UUNAME%%.*}"
UU_SPOOL_DIR="${UU_SPOOL_DIR:-/var/spool/uucppublic}" #
(spool Directory of files to be transfered using UU)
UU_LOGFILE="${UU_LOGFILE:-${UU_SPOOL_DIR}/.eStorLinkLog}" #
(Log file)
UU_DATABASE_DIR="${UU_DATABASE_DIR:-${UU_SPOOL_DIR}/.Database}"
# (Directory location of eStorLink data files)
UU_OVERWRITE="0" # (0=donot overwrite existing file
1=overwrite existing file)
UU_REMOTE_EXISTS="0" # (0=destination file does not exist
1=Destination file exists)
UU_NOTIFY_USER="webmaster@mailhost"
UU_NOTIFY_USER=""
# UU_PUT_PATH1="${UU_PUT_PATH1:-aigaix01}"
# UU_REMOTE_ALT="HQ2"
# UU_PUT_PATH2="STR004::STR004"
UU_LOCAL_FNAME="" # (local name of file before transfer)
UU_LOCAL_DIR="" # (local directory location of file
before transfer)
UU_REMOTE_FNAME="" # (remote name of file after transfer)
UU_REMOTE_DIR="" # (remote directory location of file
after transfer)
UU_PUT_PATH1="" # (List of remote destination hosts)
UU_GET_PATH1="" # (List of remote source hosts)
################################################################
while getopts othl:r:m:g:p:a:f:b:c: i $*
do
case $i in
o ) UU_OVERWRITE="1";;
l ) UU_LOCAL_FNAME=`basename ${OPTARG}`;
UU_LOCAL_DIR=`dirname ${OPTARG}`;;
r ) UU_REMOTE_FNAME=`basename ${OPTARG}`;
UU_REMOTE_DIR=`dirname ${OPTARG}`;;
m ) UU_NOTIFY_USER="${OPTARG}";;
g ) UU_GET_PATH1="${OPTARG}";;
p ) UU_PUT_PATH1="${OPTARG}";;
a ) UU_ACTION="${OPTARG}";;
f ) UU_FUNCTION="${OPTARG}";;
b ) UU_TYPE="${OPTARG}";;
c ) UU_COMMENT="${OPTARG}";;
t ) UU_SENDNOW="1";;
* ) usage ;;
esac
done
################################################################
case "_" in
"_${UU_LOCAL_FNAME}" ) echo "ERROR: Local File Name
not specified";exit;;
"_${UU_LOCAL_DIR}" ) echo "ERROR: Local Directory
not specified";exit;;
"_${UU_REMOTE_FNAME}" ) echo "ERROR: Remote File
Name not specified";exit;;
"_${UU_REMOTE_DIR}" ) echo "ERROR: Remote
Directory not specified";exit;;
esac
if [ "_${UU_GET_PATH1}" = "_" -a
"_${UU_PUT_PATH1}" = "_" ]
then
echo "ERROR: Host list not specified"
exit
fi
if [ "_${UU_GET_PATH1}" != "_" -a
"_${UU_PUT_PATH1}" != "_" ]
then
echo "ERROR: Cannot specify both GET and PUT Host list"
exit
fi
if [ "_${UU_PUT_PATH1}" != "_" -a ! -d
"${UU_LOCAL_DIR}" ]
then
echo "ERROR: Local Directory does not exist"
exit
fi
if [ "_${UU_PUT_PATH1}" != "_" -a ! -f
"${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}" ]
then
echo "ERROR: Local file does not exist"
exit
fi
UU_OPTIONS="-a ${UU_NOTIFY_USER}"
UU_OPTIONS=""
[ ${UU_SENDNOW} -eq 0 ] && UU_OPTIONS="${UU_OPTIONS} -r"
case "_${UU_OUTPUT_TYPE}" in
"_" ) exit;;
"_ascii" ) exit;;
"_none" ) exit;;
"_html" ) exit;;
"_log" ) ;;
esac
if [ "_${UU_PUT_PATH1}" != "_" ]
then
if UU_LOCAL_CHKSUM=`sum <
"${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}"`
then
UU_LOCAL_CHKSUM="${UU_LOCAL_CHKSUM%% *}"
UU_OUTPUT_FILE="${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T"
echo "#!/bin/ksh" > "${UU_OUTPUT_FILE}"
rcommand
"################################################################"
rcommand "TIMESTAMP=\"${TIMESTAMP}\""
rcommand "UU_PROGRAMID=\"${UU_PROGRAMID}\""
rcommand
"UU_OUTPUT_TYPE=\"${UU_OUTPUT_TYPE}\""
rcommand "UU_ACTION=\"${UU_ACTION}\""
rcommand "UU_FUNCTION=\"${UU_FUNCTION}\""
rcommand "UU_TYPE=\"${UU_TYPE}\""
rcommand "UU_SENDNOW=\"${UU_SENDNOW}\""
rcommand "UU_PUT_PATH1=\"${UU_PUT_PATH1}\""
rcommand "UU_GET_PATH1=\"${UU_GET_PATH1}\""
rcommand "UU_REMOTE_ALT=\"${UU_REMOTE_ALT}\""
rcommand "UU_PUT_PATH2=\"${UU_PUT_PATH2}\""
rcommand
"UU_LOCAL_UUNAME=\"${UU_LOCAL_UUNAME}\""
rcommand "UU_CURRENT_UUNAME=\"\`uname -n\`\""
rcommand
"UU_CURRENT_UUNAME=\"\${UU_CURRENT_UUNAME%%.*}\""
rcommand "UU_SPOOL_DIR=\"${UU_SPOOL_DIR}\""
rcommand "UU_LOGFILE=\"${UU_LOGFILE}\""
rcommand
"UU_DATABASE_DIR=\"${UU_DATABASE_DIR}\""
rcommand "UU_LOCAL_DIR=\"${UU_LOCAL_DIR}\""
rcommand "UU_REMOTE_DIR=\"${UU_REMOTE_DIR}\""
rcommand
"UU_LOCAL_FNAME=\"${UU_LOCAL_FNAME}\""
rcommand
"UU_REMOTE_FNAME=\"${UU_REMOTE_FNAME}\""
rcommand
"UU_LOCAL_CHKSUM=\"${UU_LOCAL_CHKSUM}\""
rcommand "UU_OVERWRITE=\"${UU_OVERWRITE}\""
rcommand "UU_OPTIONS=\"${UU_OPTIONS}\""
rcommand "case \"_\${UU_OUTPUT_TYPE}\" in"
rcommand " \"_\" ) exit;;"
rcommand " \"_ascii\" ) exit;;"
rcommand " \"_none\" ) exit;;"
rcommand " \"_html\" ) exit;;"
rcommand " \"_log\" ) ;;"
rcommand "esac"
rcommand "for UU_REMOTE_UUNAME in \`echo
\"\${UU_PUT_PATH1}\" | sed -e \"s/:/
/g\"\`"
rcommand "do"
rcommand " if [[ \"_\${UU_CURRENT_UUNAME}\" !=
\"_\${UU_REMOTE_UUNAME}\" ]]"
rcommand " then"
rcomment "Sending Send Request"
rcommand " uux \${UU_OPTIONS}
\"\${UU_REMOTE_UUNAME}!/bin/ksh
\${UU_LOCAL_UUNAME}!\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_CURRENT_UUNAME}.\${UU_LOCAL_FNAME}.T
>
!\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_REMOTE_UUNAME}.\${UU_LOCAL_FNAME}.S\"
2>&1"
rcommand " else"
rcommand " touch \${UU_LOGFILE}"
rcommand " echo \"#!/bin/ksh\" >
/tmp/eStorLink\${$}.tmp"
lcommand
"################################################################"
lcommand "touch \${UU_LOGFILE}"
lcomment "Begin \${UU_ACTION}"
lcommand "TIMESTAMP=\\\"\${TIMESTAMP}\\\""
lcommand
"UU_PROGRAMID=\\\"\${UU_PROGRAMID}\\\""
lcommand
"UU_OUTPUT_TYPE=\\\"\${UU_OUTPUT_TYPE}\\\""
lcommand "UU_ACTION=\\\"\${UU_ACTION}\\\""
lcommand "UU_FUNCTION=\\\"\${UU_FUNCTION}\\\""
lcommand "UU_TYPE=\\\"\${UU_TYPE}\\\""
lcommand "UU_SENDNOW=\\\"\${UU_SENDNOW}\\\""
lcommand
"UU_PUT_PATH1=\\\"\${UU_PUT_PATH1}\\\""
lcommand
"UU_GET_PATH1=\\\"\${UU_GET_PATH1}\\\""
lcommand
"UU_REMOTE_ALT=\\\"\${UU_REMOTE_ALT}\\\""
lcommand
"UU_PUT_PATH2=\\\"\${UU_PUT_PATH2}\\\""
lcommand
"UU_LOCAL_UUNAME=\\\"\${UU_LOCAL_UUNAME}\\\""
lcommand "UU_CURRENT_UUNAME=\\\"\`uname
-n\`\\\""
lcommand
"UU_CURRENT_UUNAME=\\\"\${UU_CURRENT_UUNAME%%.*}\\\""
lcommand
"UU_SPOOL_DIR=\\\"\${UU_SPOOL_DIR}\\\""
lcommand "UU_LOGFILE=\\\"\${UU_LOGFILE}\\\""
lcommand
"UU_DATABASE_DIR=\\\"\${UU_DATABASE_DIR}\\\""
lcommand
"UU_LOCAL_DIR=\\\"\${UU_LOCAL_DIR}\\\""
lcommand
"UU_REMOTE_DIR=\\\"\${UU_REMOTE_DIR}\\\""
lcommand
"UU_LOCAL_FNAME=\\\"\${UU_LOCAL_FNAME}\\\""
lcommand
"UU_REMOTE_FNAME=\\\"\${UU_REMOTE_FNAME}\\\""
lcommand
"UU_LOCAL_CHKSUM=\\\"\${UU_LOCAL_CHKSUM}\\\""
lcommand
"UU_OVERWRITE=\\\"\${UU_OVERWRITE}\\\""
lcommand "UU_OPTIONS=\\\"\${UU_OPTIONS}\\\""
lcommand
"UU_REMOTE_UUNAME=\\\"\${UU_REMOTE_UUNAME}\\\""
rcommand " if [ -f
\"\${UU_REMOTE_DIR}/\${TIMESTAMP}.\${UU_LOCAL_UUNAME}.\${UU_REMOTE_FNAME}\"
]"
rcommand " then"
lcomment "TIMESTAMP File already exists"
rcommand " else"
lcomment "TIMESTAMP File does not exist"
rcommand " fi"
rcommand " if [ ! -f
\"\${UU_REMOTE_DIR}/\${TIMESTAMP}.\${UU_LOCAL_UUNAME}.\${UU_REMOTE_FNAME}\"
-o \"_${UU_OVERWRITE}\" = \"_1\" ]"
rcommand " then"
rcommand " if [ \"_${UU_OVERWRITE}\" =
\"_1\" ]"
rcommand " then"
lcomment "OK to overwrite TIMESTAMP file if it exists"
rcommand " fi"
lcomment "Command Line = \${0} \${*}"
rcommand " if uudecode < \${0}"
rcommand " then"
lcomment "uudecode was successful"
rcommand " if [ -f
\"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\" ]"
rcommand " then"
rcommand " UU_REMOTE_EXISTS=\"1\""
lcomment "Remote File already exists"
lcommand "UU_REMOTE_EXISTS=\\\"1\\\""
rcommand " else"
rcommand " UU_REMOTE_EXISTS=\"0\""
lcomment "Remote File does not exist"
lcommand "UU_REMOTE_EXISTS=\\\"0\\\""
rcommand " fi"
rcommand " if [ \${UU_OVERWRITE} -eq 1 -o
\${UU_REMOTE_EXISTS} -eq 0 ]"
rcommand " then"
rcommand " if [ \${UU_OVERWRITE} -eq 1 ]"
rcommand " then"
lcomment "Overwriting remote file"
rcommand " fi"
rcommand " if cp
\"\${UU_REMOTE_DIR}/\${TIMESTAMP}.\${UU_LOCAL_UUNAME}.\${UU_REMOTE_FNAME}\"
\"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\""
rcommand " then"
lcomment "Successfully copied to remote file name"
rcommand " else"
lcomment "ERROR: Unable to copy to remote file name"
rcommand " fi"
rcommand " else"
lcomment "ERROR: Remote file already exists or flag not set
to OVERWRITE"
rcommand " fi"
rcommand " else"
lcomment "ERROR: uudecode failed"
rcommand " fi"
rcommand " else"
lcomment "ERROR: TIMESTAMP File already exists"
lcomment "ERROR: UU_OVERWRITE=\${UU_OVERWRITE}"
rcommand " fi"
rcommand " if [ -f \${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}
]"
rcommand " then"
lcomment "Comparing accuracy of transmitted file"
rcommand " UU_REMOTE_CHKSUM=\`sum <
\"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\"\`"
rcommand "
UU_REMOTE_CHKSUM=\"\${UU_REMOTE_CHKSUM%% *}\""
lcommand
"UU_REMOTE_CHKSUM=\\\"\${UU_REMOTE_CHKSUM}\\\""
lcomment "UU_LOCAL_CHKSUM=\${UU_LOCAL_CHKSUM}"
lcomment "UU_REMOTE_CHKSUM=\${UU_REMOTE_CHKSUM}"
rcommand " if [ \"_\${UU_LOCAL_CHKSUM}\" =
\"_\${UU_REMOTE_CHKSUM}\" ]"
rcommand " then"
lcomment "Check sums match"
rcommand " else"
lcomment "ERROR: Checksums do not match"
rcommand " fi"
rcommand " else"
lcomment "ERROR: Remote file was not created"
rcommand " fi"
lcomment "End \${UU_ACTION}"
lcommand "cat eStorLink\${$}.tmp >
\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_CURRENT_UUNAME}.\${UU_LOCAL_FNAME}.O"
lcommand "cat
\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_CURRENT_UUNAME}.\${UU_LOCAL_FNAME}.O
| mail -s \\\"UU File Send Confirm from
\${UU_CURRENT_UUNAME}\\\" dfrench@mtxia.com"
lcommand "grep -i \\\"^# \\\"
\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_CURRENT_UUNAME}.\${UU_LOCAL_FNAME}.O
>> \${UU_LOGFILE}"
rcommand " uux \"\${UU_LOCAL_UUNAME}!/bin/ksh
!/tmp/eStorLink\${$}.tmp\""
rcommand " fi"
rcommand " done"
rcommand "exit"
rcommand
"################################################################"
if uuencode
"${UU_REMOTE_DIR}/${TIMESTAMP}.${UU_LOCAL_UUNAME}.${UU_REMOTE_FNAME}"
< "${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}" >>
"${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T"
then
echo "Uuencoded
\"${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}\" successfully"
echo "Executing
${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T"
chmod 777
"${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T"
echo "ksh
\"${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T\""
echo "#
${TIMESTAMP}|${UU_REMOTE_UUNAME}|${UU_REMOTE_DIR}/${UU_REMOTE_FNAME}|${UU_LOCAL_UUNAME}|${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}|${UU_NOTIFY_USER}|${UU_OVERWRITE}|${UU_SENDNOW}|${UU_CURRENT_UUNAME}|Executing
Send Request" >> ${UU_LOGFILE}
ksh
"${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_LOCAL_FNAME}.T"
else
echo "ERROR Uuencode of
\"${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}\" failed"
exit
fi
fi
fi
if [ "_${UU_GET_PATH1}" != "_" ]
then
UU_LOCAL_UUNAME="`uname -n`"
UU_LOCAL_UUNAME="${UU_LOCAL_UUNAME%%.*}"
for UU_REMOTE_UUNAME in `echo ${UU_GET_PATH1} | sed -e "s/:/
/g"`
do
UU_OUTPUT_FILE="${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_REMOTE_FNAME}.T"
echo "#!/bin/ksh" > "${UU_OUTPUT_FILE}"
rcommand
"################################################################"
rcommand "TIMESTAMP=\"${TIMESTAMP}\""
rcommand "UU_PROGRAMID=\"${UU_PROGRAMID}\""
rcommand
"UU_OUTPUT_TYPE=\"${UU_OUTPUT_TYPE}\""
rcommand "UU_ACTION=\"${UU_ACTION}\""
rcommand "UU_FUNCTION=\"${UU_FUNCTION}\""
rcommand "UU_TYPE=\"${UU_TYPE}\""
rcommand "UU_SENDNOW=\"${UU_SENDNOW}\""
rcommand "UU_PUT_PATH1=\"${UU_LOCAL_UUNAME}\""
rcommand
"UU_GET_PATH1=\"${UU_REMOTE_UUNAME}\""
rcommand "UU_LOCAL_ALT=\"${UU_LOCAL_ALT}\""
rcommand "UU_PUT_PATH2=\"${UU_PUT_PATH2}\""
rcommand
"UU_REMOTE_UUNAME=\"${UU_REMOTE_UUNAME}\""
rcommand
"UU_LOCAL_UUNAME=\"${UU_LOCAL_UUNAME}\""
rcommand "UU_CURRENT_UUNAME=\"\`uname -n\`\""
rcommand
"UU_CURRENT_UUNAME=\"\${UU_CURRENT_UUNAME%%.*}\""
rcommand "UU_SPOOL_DIR=\"${UU_SPOOL_DIR}\""
rcommand "UU_LOGFILE=\"${UU_LOGFILE}\""
rcommand
"UU_DATABASE_DIR=\"${UU_DATABASE_DIR}\""
rcommand "UU_REMOTE_DIR=\"${UU_REMOTE_DIR}\""
rcommand "UU_LOCAL_DIR=\"${UU_LOCAL_DIR}\""
rcommand
"UU_REMOTE_FNAME=\"${UU_REMOTE_FNAME}\""
rcommand
"UU_LOCAL_FNAME=\"${UU_LOCAL_FNAME}\""
rcommand
"UU_REMOTE_CHKSUM=\"${UU_REMOTE_CHKSUM}\""
rcommand "UU_OVERWRITE=\"${UU_OVERWRITE}\""
rcommand "UU_OPTIONS=\"${UU_OPTIONS}\""
rcommand "if [ \"_\${UU_CURRENT_UUNAME}\" =
\"_\${UU_REMOTE_UUNAME}\" ]"
rcommand "then"
rcommand " touch \${UU_LOGFILE}"
rcommand " echo \"#!/bin/ksh\" >
/tmp/eStorLink\${$}.tmp"
lcommand
"################################################################"
lcommand "touch \${UU_LOGFILE}"
lcomment "Begin Retrieve Request"
lcommand "TIMESTAMP=\\\"\${TIMESTAMP}\\\""
lcommand
"UU_PROGRAMID=\\\"\${UU_PROGRAMID}\\\""
lcommand
"UU_OUTPUT_TYPE=\\\"\${UU_OUTPUT_TYPE}\\\""
lcommand "UU_ACTION=\\\"\${UU_ACTION}\\\""
lcommand "UU_FUNCTION=\\\"\${UU_FUNCTION}\\\""
lcommand "UU_TYPE=\\\"\${UU_TYPE}\\\""
lcommand "UU_SENDNOW=\\\"\${UU_SENDNOW}\\\""
lcommand
"UU_PUT_PATH1=\\\"\${UU_LOCAL_UUNAME}\\\""
lcommand
"UU_GET_PATH1=\\\"\${UU_REMOTE_UUNAME}\\\""
lcommand
"UU_LOCAL_ALT=\\\"\${UU_LOCAL_ALT}\\\""
lcommand
"UU_PUT_PATH2=\\\"\${UU_PUT_PATH2}\\\""
lcommand
"UU_REMOTE_UUNAME=\\\"\${UU_REMOTE_UUNAME}\\\""
lcommand
"UU_LOCAL_UUNAME=\\\"\${UU_LOCAL_UUNAME}\\\""
lcommand "UU_CURRENT_UUNAME=\\\"\\\`uname
-n\\\`\\\""
lcommand
"UU_CURRENT_UUNAME=\\\"\\\${UU_CURRENT_UUNAME%%.*}\\\""
lcommand
"UU_SPOOL_DIR=\\\"\${UU_SPOOL_DIR}\\\""
lcommand "UU_LOGFILE=\\\"\${UU_LOGFILE}\\\""
lcommand
"UU_DATABASE_DIR=\\\"\${UU_DATABASE_DIR}\\\""
lcommand
"UU_REMOTE_DIR=\\\"\${UU_REMOTE_DIR}\\\""
lcommand
"UU_LOCAL_DIR=\\\"\${UU_LOCAL_DIR}\\\""
lcommand
"UU_REMOTE_FNAME=\\\"\${UU_REMOTE_FNAME}\\\""
lcommand
"UU_LOCAL_FNAME=\\\"\${UU_LOCAL_FNAME}\\\""
lcommand
"UU_OVERWRITE=\\\"\${UU_OVERWRITE}\\\""
lcommand "grep -i \\\"^# \\\" \\\${0} >>
\${UU_LOGFILE}"
llogfile "Processing Retrieve Request"
rcommand " if [ -f
\"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\" ]"
rcommand " then"
lcomment "Remote File exists"
rcommand " UU_REMOTE_CHKSUM=\`sum <
\"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\"\`"
rcommand " UU_REMOTE_CHKSUM=\"\${UU_REMOTE_CHKSUM%%
*}\""
lcomment "UU_REMOTE_CHKSUM=\${UU_REMOTE_CHKSUM}"
rcommand " else"
rcommand " UU_REMOTE_CHKSUM=\"0\""
lcomment "Remote File does not exist"
rcommand " fi"
lcommand
"UU_REMOTE_CHKSUM=\\\"\${UU_REMOTE_CHKSUM}\\\""
lcommand "UU_OPTIONS=\\\"\${UU_OPTIONS}\\\""
lcommand
"UU_LOCAL_UUNAME=\\\"\${UU_LOCAL_UUNAME}\\\""
lcommand "if uudecode < \\\${0}"
lcommand "then"
llogfile "uudecode was successful"
lcommand "else"
llogfile "ERROR: Uudecode Failed"
lcommand "fi"
lcommand "UU_LOCAL_CHKSUM=\\\`sum <
\\\"\\\${UU_LOCAL_DIR}/\\\${TIMESTAMP}.\\\${UU_REMOTE_UUNAME}.\\\${UU_LOCAL_FNAME}\\\"\\\`"
lcommand "UU_LOCAL_CHKSUM=\\\"\\\${UU_LOCAL_CHKSUM%%
*}\\\""
llogfile "UU_LOCAL_CHKSUM=\\\${UU_LOCAL_CHKSUM}"
lcommand "if [ \\\"_\\\${UU_REMOTE_CHKSUM}\\\" =
\\\"_\\\${UU_LOCAL_CHKSUM}\\\" ]"
lcommand "then"
llogfile "Check Sums match"
lcommand "else"
llogfile "ERROR: Check Sums do not match"
lcommand "fi"
lcommand "if [ -f \\\${UU_LOCAL_DIR}/\\\${UU_LOCAL_FNAME} -a
\\\${UU_OVERWRITE} -eq 0 ]"
lcommand "then"
llogfile "Local file already exists"
lcommand "else"
lcommand " if [ -f \\\${UU_LOCAL_DIR}/\\\${UU_LOCAL_FNAME}
-a \\\${UU_OVERWRITE} -eq 1 ]"
lcommand " then"
llogfile "Overwriting Local File"
lcommand " fi"
lcommand " if [ -f
\\\${UU_LOCAL_DIR}/\\\${TIMESTAMP}.\\\${UU_REMOTE_UUNAME}.\\\${UU_LOCAL_FNAME}
]"
lcommand " then"
llogfile "TIMESTAMP file exists"
lcommand " else"
llogfile "ERROR: TIMESTAMP file does not exist"
lcommand " fi"
lcommand " if cp
\\\${UU_LOCAL_DIR}/\\\${TIMESTAMP}.\\\${UU_REMOTE_UUNAME}.\\\${UU_LOCAL_FNAME}
\\\${UU_LOCAL_DIR}/\\\${UU_LOCAL_FNAME}"
lcommand " then"
llogfile "Successfully copied TIMESTAMP file to local
file"
lcommand " else"
llogfile "ERROR: Unable to copy TIMESTAMP file to local
file"
lcommand " fi"
lcommand "fi"
lcommand "cat \\\${0} >
\\\${UU_SPOOL_DIR}/\\\${TIMESTAMP}.\\\${UU_REMOTE_UUNAME}.\\\${UU_LOCAL_FNAME}.O"
lcommand "cat
\\\${UU_SPOOL_DIR}/\\\${TIMESTAMP}.\\\${UU_REMOTE_UUNAME}.\\\${UU_LOCAL_FNAME}.O
| mail -s \\\"UU File Retrieve Confirm from
\${UU_REMOTE_UUNAME}\\\" dfrench@mtxia.com"
rcommand " uux \"\${UU_LOCAL_UUNAME}!/bin/ksh
!/tmp/eStorLink\${$}.tmp >
\${UU_LOCAL_UUNAME}!\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_LOCAL_UUNAME}.\${UU_REMOTE_FNAME}.S\"
2>&1"
lcommand "exit"
lcommand
"################################################################"
rcommand " if uuencode
\"\${UU_LOCAL_DIR}/\${TIMESTAMP}.\${UU_REMOTE_UUNAME}.\${UU_LOCAL_FNAME}\"
< \"\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}\" >>
/tmp/eStorLink\${$}.tmp"
rcommand " then"
lcomment "Uuencode was successful"
rcommand " chmod 777 /tmp/eStorLink\${$}.tmp"
rcommand " fi"
lcomment "End Retrieve Processing"
rcommand "else"
rcommand " uux \${UU_OPTIONS}
\"\${UU_REMOTE_UUNAME}!/bin/ksh
!\${UU_SPOOL_DIR}/\${TIMESTAMP}.\${UU_CURRENT_UUNAME}.\${UU_REMOTE_FNAME}.T\""
rcommand " echo \"#
\${TIMESTAMP}|\${UU_REMOTE_UUNAME}|\${UU_REMOTE_DIR}/\${UU_REMOTE_FNAME}|\${UU_LOCAL_UUNAME}|\${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}|\${UU_NOTIFY_USER}|\${UU_OVERWRITE}|\${UU_SENDNOW}|\${UU_CURRENT_UUNAME}|Sending
Retrieve Request\" >> \${UU_LOGFILE}"
rcommand "fi"
echo "#
${TIMESTAMP}|${UU_REMOTE_UUNAME}|${UU_REMOTE_DIR}/${UU_REMOTE_FNAME}|${UU_LOCAL_UUNAME}|${UU_LOCAL_DIR}/${UU_LOCAL_FNAME}|${UU_NOTIFY_USER}|${UU_OVERWRITE}|${UU_SENDNOW}|${UU_CURRENT_UUNAME}|Executing
Retrieve Request" >> ${UU_LOGFILE}
ksh -x
"${UU_SPOOL_DIR}/${TIMESTAMP}.${UU_CURRENT_UUNAME}.${UU_REMOTE_FNAME}.T"
done
fi
---- Cut Here ----
CONTACT INFORMATION AND URL's
Dana French
President
Mt Xia Technical Consulting Group
113 East Rich
Norman, OK 73069
url: http://www.mtxia.com
email: dfrench@mtxia.com
off: (405) 329-6578
cell: (405) 306-5583
ADDITIONAL URL's OF INTEREST
|