HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - Re: DDS : script/program to change tapes in a C153...
 
Operating System - HP-UX
        1840206
        Members
    
    
        2914
        Online
    
    
        110162
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-11-2002 06:48 AM
12-11-2002 06:48 AM
			
				
					
					
						Hi all,
I am sure I used to have a program/script to programmatically load the next tape in an autoloader ... For us "mean" Scots using expensive 3rd part software is not a cheap option so using free "stuff" is a lot more palatable.
Mucho-ta for karma-shift
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
I am sure I used to have a program/script to programmatically load the next tape in an autoloader ... For us "mean" Scots using expensive 3rd part software is not a cheap option so using free "stuff" is a lot more palatable.
Mucho-ta for karma-shift
	ochayethinoojimmy
			
			
				Solved! Go to Solution.
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-11-2002 06:54 AM
12-11-2002 06:54 AM
			
				
					
						
							Re: DDS : script/program to change tapes in a C1533A DDS autoloader
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						You should be able to use the "mc" command to do what you want.  I'm not sure of the full syntax of this command (we do it the expensive way!), but the man page should give you what you want.
Sy
		
		
	
	
	
Sy
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-11-2002 06:56 AM
12-11-2002 06:56 AM
Solution
			
				
					
					
						The script expects the 1st medium to be already loaded into the drive. This is
done to prevent the script from accidently overwriting media. On each
invocation it successively loads media from the $MC_MEDIALIST. 'mt offl'
and 'mt ret' commands are used to improve the script's robustness.
#!/usr/bin/sh
# fbackup(1M) chgvol script using mc(1M)
# @(#)chgvol-dk(2001-11-22)
# this script is provided 'as is' and is unsupported by HP
#
# needs to be customized
SPT=/dev/rscsi/c0t3d1 # exchanger control device (picker)
DRIVE=/dev/rmt/c0t3d0BEST # tape raw device
# slots and drive to use, see mc(1M) output
set -A MC_MEDIALIST S1 S2 S3 S4 S5
MC_DRIVE=D1
# some useful options
OFFL=1 # try to get drive offline before unloading
REW=1 # wait for drive after loading (until rewind succeeds)
SLEEP="sleep 5" # multi-purpose delay
export PATH=/usr/bin:/usr/sbin
pgm=${0##*/}
offl()
{
integer tries=0
# try until offl succeeds (maximum 10 retries)
while (($tries < 10)) && ! mt -t $1 offl; do
$SLEEP
((tries=$tries+1))
done
$SLEEP
}
rew()
{
integer tries=0
# try until rew succeeds (maximum 10 retries)
while (($tries < 10)) && ! mt -t $1 rew; do
$SLEEP
((tries=$tries+1))
done
}
robot()
{
case $1 in
occupied) mc -p $SPT -r $2 | grep -q "FULL";;
empty) mc -p $SPT -r $2 | grep -q "EMPTY";;
move) mc -p $SPT -s $2 -d $3;;
*) return 1;;
esac
}
load()
{
$SLEEP
if robot move $1 $MC_DRIVE; then
[ "$REW" ] && rew $DRIVE
$SLEEP
return 0
else
print "$pgm: Load of $1 failed!" >&2
return 1
fi
}
unload()
{
$SLEEP
[ "$OFFL" ] && offl $DRIVE
if robot move $MC_DRIVE $1; then
$SLEEP
return 0
else
print "$pgm: Unload of $1 failed." >&2
return 1
fi
}
# main
print "$pgm: [$(date)] starting..." 2>&1
print "$pgm: [$(date)] drive: $DRIVE" 2>&1
print "$pgm: [$(date)] picker: $SPT" 2>&1
print "$pgm: [$(date)] $MC_DRIVE, ${MC_MEDIALIST[@]}" 2>&1
# We want to ensure not to accidently overwrite media...
# so the 1st medium should be loaded manually by someone else.
if robot empty $MC_DRIVE; then
print "$pgm: [$(date)] Please load a medium to $MC_DRIVE!" 2>&1
exit 1
fi
for slot in ${MC_MEDIALIST[@]}; do
if robot empty $slot; then
if robot occupied $MC_DRIVE; then
# slot empty, drive full
print "$pgm: [$(date)] Unloading $MC_DRIVE to $slot ..." >&2
unload $slot
else
# slot empty, drive empty
: do nothing
fi
else
if robot occupied $MC_DRIVE; then
# slot full, drive full
: do nothing
else
# slot full, drive empty
print "$pgm: [$(date)] Loading $slot to $MC_DRIVE ..." >&2
load $slot
exit $?
fi
fi
done
print "$pgm: [$(date)] failed!" 2>&1
exit 1
#eof
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
done to prevent the script from accidently overwriting media. On each
invocation it successively loads media from the $MC_MEDIALIST. 'mt offl'
and 'mt ret' commands are used to improve the script's robustness.
#!/usr/bin/sh
# fbackup(1M) chgvol script using mc(1M)
# @(#)chgvol-dk(2001-11-22)
# this script is provided 'as is' and is unsupported by HP
#
# needs to be customized
SPT=/dev/rscsi/c0t3d1 # exchanger control device (picker)
DRIVE=/dev/rmt/c0t3d0BEST # tape raw device
# slots and drive to use, see mc(1M) output
set -A MC_MEDIALIST S1 S2 S3 S4 S5
MC_DRIVE=D1
# some useful options
OFFL=1 # try to get drive offline before unloading
REW=1 # wait for drive after loading (until rewind succeeds)
SLEEP="sleep 5" # multi-purpose delay
export PATH=/usr/bin:/usr/sbin
pgm=${0##*/}
offl()
{
integer tries=0
# try until offl succeeds (maximum 10 retries)
while (($tries < 10)) && ! mt -t $1 offl; do
$SLEEP
((tries=$tries+1))
done
$SLEEP
}
rew()
{
integer tries=0
# try until rew succeeds (maximum 10 retries)
while (($tries < 10)) && ! mt -t $1 rew; do
$SLEEP
((tries=$tries+1))
done
}
robot()
{
case $1 in
occupied) mc -p $SPT -r $2 | grep -q "FULL";;
empty) mc -p $SPT -r $2 | grep -q "EMPTY";;
move) mc -p $SPT -s $2 -d $3;;
*) return 1;;
esac
}
load()
{
$SLEEP
if robot move $1 $MC_DRIVE; then
[ "$REW" ] && rew $DRIVE
$SLEEP
return 0
else
print "$pgm: Load of $1 failed!" >&2
return 1
fi
}
unload()
{
$SLEEP
[ "$OFFL" ] && offl $DRIVE
if robot move $MC_DRIVE $1; then
$SLEEP
return 0
else
print "$pgm: Unload of $1 failed." >&2
return 1
fi
}
# main
print "$pgm: [$(date)] starting..." 2>&1
print "$pgm: [$(date)] drive: $DRIVE" 2>&1
print "$pgm: [$(date)] picker: $SPT" 2>&1
print "$pgm: [$(date)] $MC_DRIVE, ${MC_MEDIALIST[@]}" 2>&1
# We want to ensure not to accidently overwrite media...
# so the 1st medium should be loaded manually by someone else.
if robot empty $MC_DRIVE; then
print "$pgm: [$(date)] Please load a medium to $MC_DRIVE!" 2>&1
exit 1
fi
for slot in ${MC_MEDIALIST[@]}; do
if robot empty $slot; then
if robot occupied $MC_DRIVE; then
# slot empty, drive full
print "$pgm: [$(date)] Unloading $MC_DRIVE to $slot ..." >&2
unload $slot
else
# slot empty, drive empty
: do nothing
fi
else
if robot occupied $MC_DRIVE; then
# slot full, drive full
: do nothing
else
# slot full, drive empty
print "$pgm: [$(date)] Loading $slot to $MC_DRIVE ..." >&2
load $slot
exit $?
fi
fi
done
print "$pgm: [$(date)] failed!" 2>&1
exit 1
#eof
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-11-2002 06:57 AM
12-11-2002 06:57 AM
			
				
					
						
							Re: DDS : script/program to change tapes in a C1533A DDS autoloader
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Looks like a flyer ... will give it a spin ... TTFN
					
				
			
			
				
		
		
	
	
	
	ochayethinoojimmy
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP