使用 实例 1-1 上的正文来锁定一个 ClearCase VOB(version object database,版本对象数据库),做备份,然后为该 VOB 解锁。您的用户化的正文文件必须位于安装了 Backup save 程序的相同目录中(例如,在 Solaris 系统上,save 程序安装于 /usr/sbin/nsr 目录)。请在为 ClearCase VOB 配置的“客户”资源的“备份命令”(Backup Command) 属性中输入此正文的名称。在一次预定的备份中,将调用“备份命令”,而不是通常的 save 程序。
#!/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:\Q/bin/dirname $0\Q c=\Q/bin/basename $0\Q ;; * )PATH=/usr/atria/bin:/bin:/usr/bin:/usr/sbin:/usr/bin/nsr:/usr/sbin/nsr 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>& # 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=\Qgrep "${i}" /tmp/saveout$$\Q 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 |
您必须在正文中包含 save 命令以使备份发生。如果正文文件与 save 程序不在同一个目录中,备份将失败。