Sun Microsystems 2.1 manual #!/bin/sh # smcbackup Script to archive multiple SMC titles to tape

Models: 2.1

1 184
Download 184 pages 37.97 Kb
Page 87
Image 87

Examples of scripts that use smc_tar are shown below. The following script archives content to the locally-mounted /dev/rmt/0device and writes the content titles to the UFS file SMCBackup.current-datein 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"

Chapter 5 Sun MediaCenter Server Utilities 5-15

Page 87
Image 87
Sun Microsystems 2.1 manual #!/bin/sh # smcbackup Script to archive multiple SMC titles to tape