Sun Microsystems 2.1 Server User Manual


 
Chapter 5 Sun MediaCenter Server Utilities 5-15
Examples of scripts that use smc_tar are shown below. The following script
archives content to the locally-mounted /dev/rmt/0 device and writes the content
titles to the UFS file SMCBackup.current-date in the current directory.
#!/bin/sh
# smc_backup: Script to archive multiple SMC titles to tape
#
# To use, type
# smc_backup [title]+
#
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/ccs/bin:/opt/SUNWsms/bin"
date=`date +%Y.%m.%d`
outputDevice="/dev/rmt/0"
contentsFile="SMCBackup.$date"
tapeNumber=1;
titleNumber=1;
mt status -f $outputDevice || exit 1
while [ $# -gt 0 ]; do
title=$1;
if smc_tar cf ${outputDevice}n $title; then
echo "$date $tapeNumber $titleNumber $title" >> $contentsFile
titleNumber=`expr $titleNumber + 1`;
shift;
else
echo "Tape full; Rewinding ... \c"
mt -f ${outputDevice} rew
echo; echo "Insert new tape, hit return when ready \c";
read answer
tapeNumber=`expr $tapeNumber + 1`
titleNumber=1
fi
done
mt -f $outputDevice rew
echo "Content is in $contentsFile"