Amanda-Users

Re: changer problems when running from cron

2003-02-12 04:03:42
Subject: Re: changer problems when running from cron
From: Michael Bretterklieber <mbretter AT jawa DOT at>
To: jrj AT purdue DOT edu
Date: Wed, 12 Feb 2003 08:40:43 +0100
Hi,

John R. Jackson schrieb:
Let me ask again ...

What does your version of the request() function look like (the actual
code, not a general description)?

Here's the code, but I found that this function will never invoked, chg-manual ends before invoking the request() function:

The first function is info(), I added here a sleep(2) and then this part works.

The next function is loadslot(), the script exits in this function around line 312:
        if [ ! -z "$used" -a $load = $slot ];then
                # already loaded
                answer="$slot $tape"
                echo "Exit -> $answer" >> $logfile
                echo "$answer"
                exit 0
        fi



#!/bin/sh

export home=/
#export DD="/bin/dd bs=32k"
export ONLINEREGEX="61000|ONLINE|READY|sense[_ ]key[(]0x0[)]|sense key error = 0|^er=0$"

request() {
        echo -n "Request start:" >> $logfile
        echo `date` >> $logfile
        timeout=0

        while true; do

label=`grep -v no-reuse /usr/local/etc/amanda/gamed/tapelist | tail -1 | \
                while read line
                do
                        set $line
                        echo $2
                done`

                if [ $timeout -le 0 ]; then
                        echo "Bitte Band $label einlegen" \
| mail -s "$ORG AMANDA TAPE MOUNT REQUEST FOR SLOT $1" \
                        $REPORTTO 2>/dev/null
                        timeout=`expr 360 \* 60`
                fi

                echo "     -> rewind $tape" >> $logfile
                $MT $MTF $tape rewind >> $logfile 2>&1
                sleep 5
                echo "     -> status $tape" >> $logfile
used=`$MT $MTF $tape status 2>&1 | tee -a $logfile | $EGREP "$ONLINEREGEX"`
                echo "      -> loaded <$used>" >> $logfile

                echo "SEPP3" >>/tmp/changer.debug
                if [ ! -z "$used" ];then
                        break
                fi

                sleep 60
                timeout=`expr $timeout - 60`
        done

}




What is in /tmp/amanda/changer.debug?
MT -> /usr/local/sbin/ammt -f
DD -> /usr/local/sbin/amdd
Args -> -info
     -> rewind /dev/nst0
     -> status /dev/nst0
/dev/nst0 status: ONLINE BOT
     -> loaded </dev/nst0 status: ONLINE BOT>
Exit -> 42 99 1
MT -> /usr/local/sbin/ammt -f
DD -> /usr/local/sbin/amdd
Args -> -slot current
     -> rewind /dev/nst0
     -> status /dev/nst0
/dev/nst0 status: ONLINE BOT
     -> loaded </dev/nst0 status: ONLINE BOT>
Exit -> 42 /dev/nst0



While this is the most important thing :-), it would be good if we
could figure out why the script is failing.  And Christoph brings up a
very good point about the cron PATH possibly being different than your
interactive PATH.
this was also my first guess, but all the environment vars are correct set.


bye,
--
------------------------------- ----------------------------------
Michael Bretterklieber          - Michael.Bretterklieber AT jawa DOT at 
JAWA Management Software GmbH   - http://www.jawa.at
Liebenauer Hauptstr. 200        -------------- privat ------------
A-8041 GRAZ                     GSM: ++43-(0)676-84 03 15 712
Tel: ++43-(0)316-403274-12      E-mail: michael AT bretterklieber DOT com
Fax: ++43-(0)316-403274-10      http://www.bretterklieber.com
------------------------------- ----------------------------------
"...the number of UNIX installations has grown to 10, with more expected..." - Dennis Ritchie and Ken Thompson, June 1972


<Prev in Thread] Current Thread [Next in Thread>