check if a tape is inserted - Aix

This is a discussion on check if a tape is inserted - Aix ; dear aix gurus, is there a (scripted) way to check, if a tape is inserted in my aix box before running the scheduled backup. i guess, the operators frequently forget to insert the tapes. thank you tim...

+ Reply to Thread
Results 1 to 7 of 7

Thread: check if a tape is inserted

  1. check if a tape is inserted

    dear aix gurus,
    is there a (scripted) way to check, if a tape is inserted in my aix box
    before running the scheduled backup. i guess, the operators frequently
    forget to insert the tapes.

    thank you
    tim



  2. Re: check if a tape is inserted

    tim moor wrote:
    tm> dear aix gurus,
    tm> is there a (scripted) way to check, if a tape is inserted in my aix box
    tm> before running the scheduled backup. i guess, the operators frequently
    tm> forget to insert the tapes.
    tm>
    tm> thank you
    tm> tim

    Assumptions:
    drive is on /dev/rmt0;
    script/backup writes from beginning of tape;
    Then

    check the Return Code ($?) of the command:

    tctl -f/dev/rmt0 rewind

    If $? = 0, you're ready to go. If there's no tape in the drive you'll get
    the following error message:

    '/dev/rmt0: The device is not ready for operation.'

    and the code $? = 2.

    --
    "... I shook my family tree, and a bunch of NUTS fell out ..."

  3. Re: check if a tape is inserted

    for my 3582 library, I run:
    tapeutil -f /dev/rmt0 inventory | grep -p 256
    Check the "Volume Tag" field:
    Volume Tag ..................... A00004L2

    On Nov 17, 2:28 am, "tim moor" wrote:
    > dear aix gurus,
    > is there a (scripted) way to check, if a tape is inserted in my aix box
    > before running the scheduled backup. i guess, the operators frequently
    > forget to insert the tapes.
    >
    > thank you
    > tim



  4. Re: check if a tape is inserted


    c00p wrote:
    > for my 3582 library, I run:
    > tapeutil -f /dev/rmt0 inventory | grep -p 256
    > Check the "Volume Tag" field:
    > Volume Tag ..................... A00004L2
    >
    > On Nov 17, 2:28 am, "tim moor" wrote:
    > > dear aix gurus,
    > > is there a (scripted) way to check, if a tape is inserted in my aix box
    > > before running the scheduled backup. i guess, the operators frequently
    > > forget to insert the tapes.
    > >
    > > thank you
    > > tim



    the way we do is:

    m_device=${1-rmt0.1}
    m_tmp=/tmp/test_tape
    rm $m_tmp 2>/dev/null
    touch $m_tmp
    dd if=$m_tmp of=/dev/$m_device 2>$m_tmp

    a=`grep "records out" $m_tmp`
    if [ -n "$a" ]
    then
    echo "0"
    exit 0
    fi
    a=`grep "write-protected" $m_tmp`
    if [ -n "$a" ]
    then
    echo "3"
    exit 3
    fi
    a=`grep "not ready" $m_tmp`
    if [ -n "$a" ]
    then
    echo "4"
    exit 4
    fi
    echo "5"
    exit 5

    ==============================================
    hope it helps


  5. Re: check if a tape is inserted

    thank you for your reply. can you please explain what a
    m_device=${1-rmt0.1}
    does ?

    thanx tim


    "jp" schrieb im Newsbeitrag
    news:1163810468.053103.275930@m73g2000cwd.googlegr oups.com...
    >
    > c00p wrote:
    >> for my 3582 library, I run:
    >> tapeutil -f /dev/rmt0 inventory | grep -p 256
    >> Check the "Volume Tag" field:
    >> Volume Tag ..................... A00004L2
    >>
    >> On Nov 17, 2:28 am, "tim moor" wrote:
    >> > dear aix gurus,
    >> > is there a (scripted) way to check, if a tape is inserted in my aix box
    >> > before running the scheduled backup. i guess, the operators frequently
    >> > forget to insert the tapes.
    >> >
    >> > thank you
    >> > tim

    >
    >
    > the way we do is:
    >
    > m_device=${1-rmt0.1}
    > m_tmp=/tmp/test_tape
    > rm $m_tmp 2>/dev/null
    > touch $m_tmp
    > dd if=$m_tmp of=/dev/$m_device 2>$m_tmp
    >
    > a=`grep "records out" $m_tmp`
    > if [ -n "$a" ]
    > then
    > echo "0"
    > exit 0
    > fi
    > a=`grep "write-protected" $m_tmp`
    > if [ -n "$a" ]
    > then
    > echo "3"
    > exit 3
    > fi
    > a=`grep "not ready" $m_tmp`
    > if [ -n "$a" ]
    > then
    > echo "4"
    > exit 4
    > fi
    > echo "5"
    > exit 5
    >
    > ==============================================
    > hope it helps
    >



  6. Re: check if a tape is inserted


    tim moor wrote:
    > thank you for your reply. can you please explain what a
    > m_device=${1-rmt0.1}
    > does ?


    If command line parameter ${1} is not given use rmt0.1 instead. So the
    default is rmt0.1

    hth
    Hajo


  7. Re: check if a tape is inserted

    hajo,
    thank you for your post. beeing a little new to ksh-scripting i do not quite
    understand. can you please explain a littel deeper.

    thanx
    tim

    "Hajo Ehlers" schrieb im Newsbeitrag
    news:1164019052.117906.121130@m73g2000cwd.googlegr oups.com...
    >
    > tim moor wrote:
    >> thank you for your reply. can you please explain what a
    >> m_device=${1-rmt0.1}
    >> does ?

    >
    > If command line parameter ${1} is not given use rmt0.1 instead. So the
    > default is rmt0.1
    >
    > hth
    > Hajo
    >



+ Reply to Thread