| #!/bin/ksh
# nsr_save_mailworks
# V1.0 29-Apr-1997 Terry Lemons
#
# This script is called by NetWorker as a pre-/post-processing procedure to
# back up partitions on a MAILworks server. Backing up the MAILworks user
# area while the MAILworks server is active can result in NetWorker saving
# user data that is in the act of being changed by the user. So, the
# MAILWORKS Server process is shutdown before the user area is backed up,
# and restarted when the backup is completed. An additional enhancement
# was to shut down/start up the MAILworks server only if a full backup
# (scheduled via NetWorker) was being done.
#
# This script was assembled by Terry Lemons from prior works of
# Kathleen Berry (who wrote the crontab job that this script supercedes)
# and Wes Ono (DECWET::NETWORKER notes file note 27.3).
#
# A key point to bear in mind about NetWorker V4 pre-/post-processing
# procedures is that they are executed for every NetWorker saveset (which
# equates to UNIX paritions). Thus, if, in the NetWorker client, three
# savesets are defined, then this script would be executed three times.
# Another key point is that, based on the values of parallelism, these
# three savesets could be executed at the same time.
#
# To aid in understanding how this script works, here is an example of
# what arguments are passed to the script by NetWorker. The -N argument
# contains the name of the partition being backed up, and will be used later.
# -s mrcofe.zso.dec.com -g Default -LL -f - -m decaf.zso.dec.com
# -l incr -q -W78 -N /usr /usr
#
# customize the PATH to include necessary directories
#
PATH=/bin:/usr/bin:
#
# ADD THE MAILWORKS USER AREAS TO THE FOLLOWING COMMAND, SEPARATED BY SPACES.
#
set -A MAILWORKS_USER_AREAS /usr/users /usr/user1
typeset MAILWORKS_USER_AREA_TRUE="N"
#
# Take the arguments passed to the command procedure, and places the ones
# that are useful into variables. NOTE: a colon after an option means the
# option requires an argument. -q, for instance, does not.
#
while getopts s:g:L:f:m:t:l:qW:N: opt
do
case $opt in
s) SERVER=$OPTARG;;
g) GROUP=$OPTARG;;
f) FILE=$OPTARG;;
m) MASQUERADE=$OPTARG;;
t) TIME=$OPTARG;;
l) LEVEL=$OPTARG;;
W) WIDTH=$OPTARG;;
N) NAME=$OPTARG;;
L) ;;
q) ;;
*) echo "Error: $opt $OPTARG";;
esac
done
#
# Compare the partition being backed up in this run (NAME) to the MAILworks
# partions listed in the MAILWORKS_USER_AREAS array. If found, do the special
# MAILworks processing for this run.
#
typeset -i num=0
while (( $num < ${#MAILWORKS_USER_AREAS[*]} ))
do
if [[ ${MAILWORKS_USER_AREAS[num]} = $NAME ]]
then
typeset MAILWORKS_USER_AREA_TRUE="Y"
break
fi
((num=num + 1))
done
#
# If this execution is saving the MAILworks user area, then shutdown MAILworks
#
if [[ $LEVEL = full && $MAILWORKS_USER_AREA_TRUE = Y ]]
then
/usr/opt/DMW/bin/stopMAILworks
echo 'Stopping MAILworks Server'
fi
#
# Execute the NetWorker save command to backup the saveset [=partition] to the
# NetWorker server.
#
if [[ $LEVEL = full ]]
then
save -s "$SERVER" -g "$GROUP" -LL -f "$FILE" -m "$MASQUERADE" -l "$LEVEL" \
-q -W "$WIDTH" -N "$NAME" "$NAME"
else
save -s "$SERVER" -g "$GROUP" -LL -f "$FILE" -m "$MASQUERADE" -t "$TIME" \
-l "$LEVEL" -q -W "$WIDTH" -N "$NAME" "$NAME"
fi
#
# If this execution is saving the MAILworks user area, then startup MAILworks
if [[ $LEVEL = full && $MAILWORKS_USER_AREA_TRUE = Y ]]
then
/usr/opt/DMW/bin/startMAILworks
echo 'Starting MAILworks Server'
fi
# End of procedure nsr_save_mailworks
|