Building TSM scripts.
![]() |
|
TSM Scripting Hints
Send offsite and recall Copy tapes
Free up tapes which are almost empty
Multiple macro commands
Exporting scripts
Updating Netware Client Passwords
Send offsite and recall Copy tapes
To move tapes offsite schedule this command daily
Command: update vol * access=offsite
where access=readwrite
where stg=copy_pool location='offsite_location'
where status=full
{just send out full tapes}
To recall back onsite schedule this command weekly
Command: update vol * access=readwrite
where access=offsite
where stg='offsite_location='
where status=empty
{recall empty tapes}
Free up tapes which are almost empty
The script is
for volume in
$(dsmadmc -id=adminname -pass=adminpass -outfile
"select 'MARKER', volume_name from volumes
where pct_utilized >20 "
| grep '^MARKER' | cut -b 12-) ;
do dsmadmc -id=adminname -pass=adminpass -outfile
'move data ${volume} options..' ; done
Explanation : Use an SQL query to generate a list of almost empty tapes
SELECT 'MARKER', volume_name stgpool_name,pct_utilized from volumes WHERE PCT_UTILIZED < 10 will output something like : MARKER VOLUME_NAME STGPOOL_NAME PCT_UTILIZED ---------- ------------------ ------------------ MARKER A40012 pool-name 8.1 MARKER A40015 pool-name 2.0
Use the grep command to extract lines we want
grep 'MARKER' gives MARKER A40012 MARKER A40015
use cut to extract the tape volsers
cut -b 12- gives A40012 A40015
Multiple macro commands
If you specify several commands in a macro, sometimes the macro does not seem to get past the first command. Try using 'commit' after each statement:
q vol access=destroyed commit q vol access=unavail commit
Exporting scripts
The query script command will list out the names of all your scripts and their descriptions like this
Name: QUERY_BACKUPS
Description: Query Daily Backups
Managing profile:
If you want to export your scripts, say to build another server, then you need to know the details. The command to use is
Q script f=macro
which will produce output in a format that can be executed as a macro. If you pipe that command to a file, the file can be copied to another server for execution.
Updating Netware Client Passwords from a script
If you have an audit requirement to change your Netware administration password on a regular basis, it is a real pain and time consuming to have to log into each client individually, run a single file backup, and manually input the new password.
You can do this with a script from the Netware command line. You still need to log into each client but you do not need to enter all the backup details manually. You must use the -NWPWFILE=YES option or the password file will not be updated. A suggested full script, which picks up a file that should exist on every server is:
dsmc sel sys:/Tivoli\TSM\CLIENT\BA\dsm.opt -nwuser=servername\ userid:password -nwpwfile=yes
