Solstice Backup 5.1 管理者ガイド

カスタマイズしたバックアップコマンドを作成するには

バックアッププログラムまたはバッチファイルの作成に使用される構文は、以下に示す基準に従っていなければなりません。以下に項目のリストとプログラミングの例を示します。これらの基準に従うことができない場合には、独自のバックアップコマンドは作成しないでください。

プログラムには、次に示す順序でコマンドが含まれていなければなりません。

バックアップの前処理または後処理のコマンドを作成するには、次の操作を行います。

  1. テキストエディタを使用して、Backup の save コマンドが置かれているディレクトリにプログラムファイルを作成します。

  2. 「Clients」リソースの「Backup Command」属性に、バックアッププログラム名を入力します。

  3. 作成したバックアップコマンドが動作することを確認するために、クライアントをバックアップしてみます。

例 : カスタマイズしたバックアップコマンド

次に示すスクリプトは、前処理と後処理を実行するカスタマイズしたバックアップコマンドの例です。このスクリプトは Clear Case VOB (Version Object Base) をロックし、バックアップを実行してから、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