Need help updating my AIX shell script that uses IBM tape tool.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help updating my AIX shell script that uses IBM tape tool.
# 8  
Old 02-10-2016
You might be able to merge something like this into your code:
Code:
#!/bin/ksh
BASESLOT=4096
ConfigDir='/path/used/to/store/TapeSlotFile'
IAm=${0##*/}
TapeSlotFile="$ConfigDir/${IAm}_slot"

if [ ! -r "$TapeSlotFile" ]
then	printf '%s: Warning: Configuration file (%s) Not found.\n\t%s\n' \
	    "$IAm" "$TapeSlotFile" 'It is being created now.' >&2
	TAPE=0
	if ! echo "$TAPE" > "$TapeSlotFile"
	then	printf "%s: Error: Can't create tape slot file.\n\t%s\n" \
		    "$IAm" 'Terminating.' >&2
		exit 1
	fi
	# The following line is not needed if only root will run this script.
	chmod 664 "$TapeSlotFile"
else	read TAPE < "$TapeSlotFile"
	TAPE=$(((TAPE + 1) % 23))
	if ! echo "$TAPE" > "$TapeSlotFile"
	then	printf "%s: Error: Can't update tape slot file (%s).\n\t%s\n" \
		    "$IAm" "$TapeSlotFile" 'Terminating.' >&2
		exit 2
	fi
fi
SLOT=$((BASESLOT + TAPE))
printf 'Assigned tape slot: %d\n' "$SLOT"

Note that it is using $TAPE values 0 through 22 to select from $SLOT values 4096 through 4118. I'm sure you can make adjustments if the assigned slot range is off. You definitely need to set the ConfigDir variable (on the line shown in red in the script) to the name of a directory where anyone who should be running this script has permission to create files. And, if the users running the script don't all have the same user ID (such as root), they need to at least run with the same group ID.
This User Gave Thanks to Don Cragun For This Post:
# 9  
Old 02-11-2016
That worked great, implemented it in my script and I can manage all 23 slots with itdt now. Thank you!
# 10  
Old 02-11-2016
I'm glad to hear that the code I suggested helped you.

Note that if one of the volunteers here submits a post that helps you learn how things work or helps you solve a problem you were having, hitting the Smilie Thanks button at the lower left corner of that post is one way to convey your thanks.
# 11  
Old 02-12-2016
Good to know, done that now.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help updating my AIX shell script that uses IBM tape tool.

I have a shell script that interfaces with our tape library using IBM's Tape Diagnostic tool called "itdt". The script does some basic stuff, it queries the tape library, loads tape to/from drive; it knows which inventory slot to pick the tape from based on SLOT=$(($BASESLOT + $TODAY)). The... (1 Reply)
Discussion started by: tmonk1
1 Replies

2. AIX

IBM Virtual Machine OS on intel x86 and x64? IBM AIX OS on IBM Virtual Machine?

Hi There, I have zero information and zero knowledge for IBM virtual machine except Amazon cloud and VMware ESXi (Only Linux OS available). Anyone could provide me the following answer - Can IBM VM been deploy on X86 and X64 (Intel Chip)? If answer is yes any chance to deploy AIX OS... (13 Replies)
Discussion started by: chenyung
13 Replies

3. Shell Programming and Scripting

Shell script executed from Informatica ETL tool is spawning 2 processes for one script

Hi, I am having a shell script which has a while loop as shown below. while do sleep 60 done I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Discussion started by: chekusi
2 Replies

4. Shell Programming and Scripting

I want a script to view the complete log information of data stage job from UNIX IBM AIX.

Hi, I am working on data stage 8.7 version and I want a script a to view the all log information of the data stage job from UNIX environment. Can you please help me out by give the script. Thanks in advance... (7 Replies)
Discussion started by: victory
7 Replies

5. AIX

Ejecting tape on AIX & Some Tape commands

I am trying to use this command to eject the tape mt -f /dev/rmt/0 unload but it gives me error mt -f /dev/rmt/0 unload mt: 0511-575 unload is not a recognized subcommand. Usage: mt Subcommand Valid subcommands are: weof eof fsf bsf ... (5 Replies)
Discussion started by: filosophizer
5 Replies

6. Shell Programming and Scripting

Need help in updating the tables inside shell script

I have an input file with contents like : 1LMXTJJD0W28TX2 1LS1XJGDEVWAC5T 1LK81JVDE2HRNDG 1LMXTJJD0W28TX2 1LS1XJGDEVWAC5T 1LK81JVDE2HRNDG 1LMXTJJD0W28TX2 I need to read each field from the file pass it to a query: select count(*) from usage_error where usage_id='$field... (17 Replies)
Discussion started by: Rajesh Putnala
17 Replies

7. AIX

IBM AIX on IBM Eseries & x series server

Hi, I want to know whether IBM AIX can be installed on the IBM e series and x series server hardware? Thanks & Regards Arun (2 Replies)
Discussion started by: Arun.Kakarla
2 Replies

8. AIX

Backup script for Aix without tape mount

Hi, My situation is to write a backup script for AIX server which doesnt have a tape mounted. They have created a folder on windows so that all AIX backup files can be moved to that windows folder where they will put these AIX backup files on a tape. Appreciate help. Regards dsrules. (7 Replies)
Discussion started by: dsrules
7 Replies

9. Shell Programming and Scripting

updating a column in oracle table using shell script

Hi friends, i am having a variable declared in .profile.i am changing its value in a shell script and then i am connecting to oracle and then from there i am calling a .sql called update.sql STATUS is the variable declared in the .profile =============================== if sqlplus <<END... (3 Replies)
Discussion started by: sveera
3 Replies
Login or Register to Ask a Question