[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference decwet::networker

Title:NetWorker
Notice:kits - 12-14, problem reporting - 41.*, basics 1-100
Moderator:DECWET::RANDALL.com::lenox
Created:Thu Oct 10 1996
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:750
Total number of notes:3361

639.0. "MAILworks server pre-/post-processing script" by SANITY::LEMONS (And we thank you for your support.) Tue Apr 29 1997 11:26

    Thanks to the generous help of many of you, especially in note 485.*,
    here is a pre-/post-processing script for backing up a MAILworks
    server.
    
    Highlights:
    o runs as part of a 'nightly backup' savegroup, or a savegroup just for
    this MAILworks system;
    o uses the schedule, directive, saveset list and all other parameters
    set in the standard NetWorker client entry on the server;
    o a copy of this script needs to be placed on each MAILworks server, in
    the same directory where the NetWorker 'save' program is;
    o the script needs to be edited with the list of partitions that
    contain MAILworks user directories;
    o the script will shutdown MAILworks before the backup, and startup
    MAILworks after the backup.  To meet my site needs, MAILworks is
    shutdown only when a full backup is done, which is only on the
    weekends.  The script could easily be modified to allow different
    behavior.  Note that MAILworks is shutdown/started only when backing up
    disks with MAILworks user data on them, as per the list of such
    disks/partitions you edit into the script.  You don't have to edit in
    the list of ALL disks; this is held in the client record back on the
    server.
    
    See the excellent ( :) ) documentation in the script for more usage and
    design information.
    
    The script, nsr_save_mailworks, is in the first reply to this note. 
    Please offer suggestions and {shudder} corrections, and distribute and
    use this widely.
    
    Thanks!
    tl
T.RTitleUserPersonal
Name
DateLines
639.1nsr_save_mailworksSANITY::LEMONSAnd we thank you for your support.Tue Apr 29 1997 11:27102
#!/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