Script per il labeling dei tape di amanda: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Stub}}
Lanciare lo script dandogli come argomento la lettera del set. In caso di più set, eseguirlo più volte:
 
sudo -u backup /path/to/script A
 


<pre>
<pre>
#!/bin/bash
#!/bin/bash
VERSION=1.0.0
VERSION=1.0.1
if [ $(id -nu) != "backup" ]
if [ $(id -nu) != "backup" ]
then
then
Line 33: Line 36:
         TAPE="${TAPESET}-0${i}-${day[i]}"
         TAPE="${TAPESET}-0${i}-${day[i]}"
         echo -e "\a"
         echo -e "\a"
         read -n 1 -p "Please insert tape $TAPE and press any key (s=skyp)" KEY > /dev/null  
         read -n 1 -p "Please insert tape $TAPE and press any key (s=skip)" KEY > /dev/null  
         if [ "$KEY" != "s"  ]
         if [ "$KEY" != "s"  ]
         then
         then
                 amlabel DailySet1 $TAPE
                 amlabel -f DailySet1 $TAPE
                 mt -f /dev/st0 offline
                 mt -f /dev/st0 offline
                 echo -e "\n"
                 echo -e "\n"

Latest revision as of 16:07, 15 October 2012

Lanciare lo script dandogli come argomento la lettera del set. In caso di più set, eseguirlo più volte:

sudo -u backup /path/to/script A


#!/bin/bash
VERSION=1.0.1
if [ $(id -nu) != "backup" ]
then
        echo Yous should run this script as user "backup".
        echo Aborting.
        exit 127
fi
echo labeltape $VERSION
if [ -z "$1" ]
then
        echo "Usage:"
        echo "labeltapes TAPESET"
        echo "where TAPESET=[A|B|C...]"
        echo "Aborting."
        exit 127
fi

TAPESET=$1

day[1]="MON"
day[2]="TUE"
day[3]="WED"
day[4]="THU"
day[5]="FRI"
echo -e "\n"

for i in 1 2 3 4 5
do
        TAPE="${TAPESET}-0${i}-${day[i]}"
        echo -e "\a"
        read -n 1 -p "Please insert tape $TAPE and press any key (s=skip)" KEY > /dev/null 
        if [ "$KEY" != "s"  ]
        then
                amlabel -f DailySet1 $TAPE
                mt -f /dev/st0 offline
                echo -e "\n"
        fi
done
echo Finished.
echo -e "\a"
sleep 1
echo -e "\a"