Sun Microsystems 2.1 Server User Manual


 
5-16 Sun MediaCenter Server Administrator’s Guide December 1997
The following script locates a specified content title from a previously-created
SMCBackup.date file. It then prompts you to load the appropriate tape to restore the
archived title from the locally-mounted /dev/rmt/0 device.
#!/bin/ksh
# smc_restore: Script to restore an SMC backup
usage() {
echo "usage: smc_restore [-c ContentsFile] [title]+" >&2
}
printNumber() {
case $1 in
*1)echo "$1st";;
*2)echo "$1nd";;
*3)echo "$1rd";;
*) echo "$1th";;
esac
}
date=`date +%Y.%m.%d`
inputDevice="/dev/rmt/0"
contentsFile="SMCBackup.$date"
if set -- `getopt "c:" $*`; then
while [ $# -gt 0 ]; do
case "$1" in
-c) contentsFile=$2;
shift 2;;
--) shift;
break;;
-*) usage;
exit 1;;
*) break;
;;
esac
done
fi
for t in $*; do
found=false;
grep $t $contentsFile | while read date tape fileNumber title; do
echo "$t is the `printNumber $fileNumber` title on the `printNumber $tape`
tape created on $date"