Scripting within TSM... Just what can be done?

Rob Stroud

ADSM.ORG Member
Joined
Dec 11, 2007
Messages
34
Reaction score
1
Points
0
Hi Guys,

I've seen some very smooth scripts on some client sites but never been able to get copies.. :(

Just what is the TSM Script 'shell?' able to do?

Loop, goto, exit, if.... Type things?

Does anyone have a function/keyword ref or at least know which sys it's based on?

I feel that this would also be a worthy area for a sticky.
 
Tsm Scripts are *very* basic and not based on any other scripting language. You get a very very basic IF statement, Labels, and a GOTO and an EXIT and thats about it apart from SERIAL and PARALLEL.

You can do loops using an IF and a GOTO, with some sort of query or command immediately before the IF (the IF merely examines the return code of the previous command, there will be some examples on this site if you search for goto probably).

Tsm scripts can call other scripts the usual way (run <script>) but you can't embed them too far, I think 9 is the maximum depth you can call down to (vague recollection from memory)
 
TSM scripting is limited it is true but that's not to say there are any limits to scripting it...

The TSM database is a standard prioprietary relational database and accepts standard SQL statements. Using these in a script can be very powerful.

I run a 2000+ line KSH script as well as a few other smaller ones that interface with our helpdesk, management, customers and admins using all the usual UNIX stuff (sed, awk, etc) as well as automatically mailing reports to all concerned in HTML format.

In this code I use batch file mode, SQL, TSM commands, and call TSM scripts etc, all menu driven and prettied up using TPUT commands and the terminfo. :) I even have a few C programs...all culminating in almost automated push-button TSM administration under standard conditions.

TSM is awesome to script with and extremely powerful if you know it well at the command line level. I would recommend learning SQL; It is an exellent skill to have as a TSM admin.
 
Maybe I misunderstood the question. My answer was in relation to TSM admin scripts and these are very limited as I stated, these are the ones you create using the "def script" admin command.

Otherwise, scripting for TSM with a ksh shell or perl or whatever language of your choice is really easy and loads of people do it. We have script packages with thousands of lines of code for TSM management... sure we could buy software but it wouldn't do what our scripts can do! :)
 
Thanks guys,

Does anyone know if IBM are planning or would consider expanding this capability??

At the end of the day flexibility is one of TSMs greatest strengths & a self contained scripting shell that can loop count and interact with the shell or just do something mad like:-
execute shell /tsm/dly.sh
or
audit vol $1 fix=yes | /tsm/vols.out

Just an idea but I feel that anything that can bring scripting within TSM can only make it an even more powerful product.
 
Last edited:
Have a look at "Server Scripts" part of Richard Sims'

http://people.bu.edu/rbs/ADSM.QuickFacts

I too am looking forward to see more features and enhancements to the TSM scripting... However, I agree with BBB and ypcat... one can do a lot using TSM integrated with shell/perl/OS-side scripting...
 
You can actually run an external shell script from within a TSM script as you have mentioned above, using a bit of a trick, but it works very well if you need it (I use it all the time).

Ensure that your TSM server has a TSM client node setup on it as well, and registered to the TSM server itself.

Then in your TSM script, run "def clientact <servers_nodename> ...." and I can't quite remember the rest of the flags but it would be something like: type=command obj="/tsm/dly.sh" wait=yes. You can then check the return code from the external shell script with a TSM if statement.

Scripting inside TSM isn't completely bad, no you can't do loops over volume names or whatever, but you can do some stuff using a little lateral thinking. Eg. you can have a daily maintenance tsm script that automatically handles weekends differently from weekdays.

ps. Some admins argue for using only external scripts for TSM, others only for internal, others for a combination depending on whats best for what you're trying to do.
 
Last edited:
Back
Top