請使用 範例 1-1 指令集以鎖定一個「未加密 VOB」(版本物件資料庫),作好備份,再解除此 VOB 的鎖定。您自訂的指令集檔案必須駐在與 Backup save 程式安裝所在的同一目錄裡(例如,在 Solaris 系統上,save 程式是安裝在 /usr/sbin/nsr 目錄)。您把指令集的名稱輸入為 ClearCase VOB 配置的客戶機資源其「備份指令」屬性中。在排定的備份中,被調用的是「備份指令」,而非常用的 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 程式相同的目錄,備份就會失敗。