1758473 Members
2560 Online
108871 Solutions
New Discussion юеВ

Script Help

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

Script Help

Ok, Still dealing with this dat auto loader issue. I was told to go to this link and use this script in conjunction with my fbackup -y command. I still am not sure how I do this. Do I start the fbackup command on 1st line and then append this script? Can someone please advise?

#!/usr/bin/sh
####################
# chgvol for autoloaders
# Revision 1.0
# Date: 12/21/99
# Author: James Kirkland / jtk@atl.hp.com
# Purpose: To allow fbackup to work with autoloaders
# NOTE! This script is not supported by HP. It is provided as an example only!!
####################

# Setting up variables

TMPDIR=/var/tmp
RTDIR=/var/adm/chgvol
SES_FILE=$RTDIR/session
NUM=$TMPDIR/chg_num.tmp
PICKER=/dev/picker # device file for the robotic arm

#scripting

get_current_pid(){
NOW_PID=`ps -ef |grep fbackup |grep -v grep | cut -c 10-16`
return 0
}


is_sess_old (){
S_PID=`tail -1 $SES_FILE`
get_current_pid
if [ $NOW_PID -eq $S_PID ]
then
echo "Continuing with current session from fbackup PID $S_PID"
else
echo "This is the first tape change for fbackup PID $NOW_PID"
echo $NOW_PID > $SES_FILE
init_num
fi
return 0
}

init_num() {
echo "1" > $NUM
return 0
}

if [ -a $SES_FILE ]
then
is_sess_old
else
touch $SES_FILE
is_sess_old
fi
if [ -a $NUM ]
then
S_NUM=`cat $NUM`
else
init_num
S_NUM=`cat $NUM`
fi
S_NUM_OLD=$S_NUM
let S_NUM=S_NUM_OLD+1
if [ $S_NUM_OLD -gt 0 ]
then
echo "Moving tape from Drive 1 to Slot $S_NUM_OLD ."
mc -p $PICKER -s D1 -d S$S_NUM_OLD
#err code needed
echo "Moving tape from Slot $S_NUM to Drive 1 ."
mc -p $PICKER -s S$S_NUM -d D1
#err code needed
echo $S_NUM > $NUM
logger -t chgvol -p local0.info "Changing tape. Pulling from Slot
$S_NUM"
fi
exit 0

UNIX IS GOOD
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: Script Help

Hi Robert:

A key element is to declare the script (by name) in 'fbackup's configuration file (which you should have anyway to provide adequate 'fbackup' performance).

Have a look at the man pages for 'fbackup'. In the configuration file ('-c) is an optional entry "chgvol". The value of this argument is the name of the executable script.

Regards!

...JRF...

harry d brown jr
Honored Contributor

Re: Script Help

This needs to run as a seperate process. So start your fbackup, then launch this script.

live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: Script Help

JRF is correct. what the hell was I thinking? I need more coffee - give me n/a's for being braindead (I wonder if I'm management ready now?).

live free or die
harry
Live Free or Die
Helen French
Honored Contributor

Re: Script Help

Hi Robert:

Read this document and the steps provided at the begining to add the script (TKB #DKKBRC00006969):

http://us-support.external.hp.com/cki/bin/doc.pl/sid=9a0f0b85118e3cfb5f/screen=ckiDisplayDocument?docId=200000057768469

HTH,
Shiju
Life is a promise, fulfill it!