Jure Krasovic wrote:

> Hoj!
>
> A ima kdo idejo kako bi pred zacetkom backup-a ugotavlal ali je trak
> vstavljen v tracno enoto!

Izsekal sem ti del skripte. Morda ti bo pomagalo:

#!/bin/sh

CONTROL_TAPE_DEV=/dev/xst0
DATA_TAPE_DEV=/dev/nst0
MT_PROGRAM=mt
DD_PROGRAM=dd
NONULL_PROGRAM=/etc/nonull
REWIND_CMD=rewind
OFFLINE_CMD=offline
STATUS_CMD=status

#
# Statusi traka
#

STATUS_ONLINE=" ONLINE "
STATUS_WR_PROTECTED=" WR_PROT "
STATUS_DOOR_OPEN=" DR_OPEN "

check_tape_dev()
{
        TAPE_INQ=`${MT_PROGRAM} ${STATUS_CMD} ${CONTROL_TAPE_DEV} | grep 
"${STATUS_ONLINE}" | wc -l`
        if [ $TAPE_INQ = 1 ]; then
                TAPE_INQ=`${MT_PROGRAM} ${STATUS_CMD} ${CONTROL_TAPE_DEV} | grep 
"${STATUS_WR_PROTECTED}" | wc -l`
                if [ $TAPE_INQ = 1 ]; then
                        echo "TAPE STATUS: Tape is write protected!";
                        CURR_TAPE_STATUS=0
                else
                        echo "TAPE STATUS: Tape is ready!"
                        CURR_TAPE_STATUS=0
                fi
        else
                TAPE_INQ=`${MT_PROGRAM} ${STATUS_CMD} ${CONTROL_TAPE_DEV} | grep 
"${STATUS_DOOR_OPEN}" | wc -l`
                if [ $TAPE_INQ = 1 ]; then
                        echo "DAILY-BACKUP: Tape not present!"
                        CURR_TAPE_STATUS=-1
                else
                        echo "DAILY-BACKUP: Unknown tape status!"
                        CURR_TAPE_STATUS=-1
                fi
        fi
}

=b

--
============================================================================
Boris Benko, dipl.ing.                | E-mail: [EMAIL PROTECTED]
Telekom Slovenije, PE Murska Sobota   |         [EMAIL PROTECTED]
Senior Prog./Sys admin./Informatik    |         [EMAIL PROTECTED]
Slu§ba za informatiko                 | Phone: (work) +386 69 14 632
                                      |        (mobile) +386 609 645 256
                                      |        (home) +386 69 37 499
===========================================================================


Одговори путем е-поште