Solstice Backup 5.1 Administration Guide

How to Create Customized Backup Commands

The syntax you use to create the backup program or batch file must adhere to the criteria described in the following list. The list is detailed and includes programming details. Do not attempt to write your own backup command unless you can follow these recommendations.

The program should contain commands in the following order:

Follow these steps to create a pre- or post-backup command:

  1. Use a text editor to create a program file in the directory where the Backup save command resides.

  2. Enter the name of the backup program in the Backup Command attribute of the Clients resource.

  3. Try backing up the client to ensure that the backup command you created works.

Example: Customized Backup Command

The following script is an example of a custom backup command that does pre- and post-processing. This script locks a ClearCase VOB (version object base), does the backup, then unlocks the VOB.


#!/bin/sh
# export the SHELL that we are going to use
SHELL=/bin/sh
export SHELL
# export the correct PATH so that all the required binaries can be
found
case $0 in
/* ) PATH=/usr/atria/bin:/bin:/usr/bin:`/bin/dirname $0`
c=`/bin/basename $0`
;;
* )PATH=/usr/atria/bin:/bin:/usr/bin:/usr/sbin
c=$0
;;
esac
export PATH
# These are the valid statuses which save reports on completion of
the backup
statuses="
failed.
abandoned.
succeeded.
completed savetime=
"
# Perform the PRECMD (Lock VOB)
/usr/atria/bin/cleartool setview -exec
"/usr/atria/bin/cleartoollock -c \
  `VOB backups in progress' -vob /cm_data/mis_dev" magic_view >
/tmp/voblock.log 2>&1
# Perform backup on client
save "$@" > /tmp/saveout$$ 2>&1
# cat out the save output
cat /tmp/saveout$$# search for the backup status in the output reported by save
for i in ${statuses}; do
      result=`grep "${i}" /tmp/saveout$$`
      if [$? != 0]; then
               echo ${result}
      fi
done
# Perform the POSTCMD (Unlock VOB)
/usr/atria/bin/cleartool setview -exec
"/usr/atria/bin/cleartoolunlock -vob
/cm_data/mis_dev" \
    magic_view > /tmp/vobunlock.log 2>&
# make sure to gracefully exit out of this shell script
exit 0