• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

Script to cancel all process

moon-buddy

ADSM.ORG Moderator
#2
The difficulty of writing a script that stops processes that is task specific is knowing what task TSM is running at a point in time, and the process number.

One technique is to search for key words that you know corresponds to a tape related process. Let us say TSM is running Space Reclamation. If you do a "q proc", you will see all the process that are running and one would be "Space Reclamation".

722 Space Reclamation Volume A12345L2 (storage pool LTOPOOL) ...

The number before "Space Reclamation" is the process number which you are interested about.

If you write a script like:

dsmadmc -id=userid -password=user_password -dataonly=yes "q proc" | grep "Space Reclamation" | awk '{print $1}'

you will end up with 722 as a result, and for which corresponds to the process number you need to cancel.

To complete the script:

PROC=`dsmadmc -id=userid -password=user_password -dataonly=yes "q proc" | grep "Space Reclamation" | awk '{print $1}'`

dsmadmc -id=userid -password=user_password -dataonly=yes "cancel proc $PROC"

This would be a good starting point. You can create a list of known processes that is tape specific and cancel one-by-one listed processes using these two lines of script.

This is one way.
 
Last edited:

PJ

ADSM.ORG Senior Member
#3
dsmadmc -se=myserver -id=myadmin -pa=mypw -dataonly=yes "select process_num from processes" |while read procnum
do
dsmadmc -se=myserver -id=myadmin -pa=mypw can proc ${procnum}
done
 

baldomero83

ADSM.ORG Member
#4
Hello all
i need a script to Stop ALL procees , before night backups.
Especially process that occupied tapes drive.
please advice
thanks
bb
[email protected] :confused:

try to use the duration parameter in your administrative scheduling for server process (migration, stgp backup, reclamation) . I think is basically an scheduling exercise , try to make sure your migration , backup stgp and reclamations are completed b4 the next day's cylce.
having to stop processes -either manually or scripted means that you have'nt really put time to check the schedulings..
 

n9hmg

ADSM.ORG Senior Member
#5
for process in `dsmadmc -id=$user -pass=$pass -tab select process_num from processes |grep ^[1-9]`
do
dsmadmc -id=$user -pass=$pass cancel process $process
done

I'll leave it to you to populate the user and pass variables.
 

tsmtodd

ADSM.ORG Member
#6
IBM needs to implement an "end_time" parm. Duration doesn't work well when you have a varying start time.
reclaim stgpool <stgpoolname> thre=60 stopdate=today stoptime=17:00 would be great! Too bad it doesn't exist.
 

PJ

ADSM.ORG Senior Member
#7
Yep... agreed - or at least a "can pr all" similar to "can se all".

PJ

(or you return to good old threshold driven migration and reclamation, which should fix your particular problem, too)
 
Last edited:

mateinone

ADSM.ORG Moderator
#8
whilst you can write a script to kill all processes, if you want to effectively end everything cleanly, then a cancel proc xxx for each device is not an effective way to end things.

It is ineffective in cancelling expirations, migrations and reclamations.

What OS are you currently running?

also are all of your storage pool migrations set at the same level when not migrating???

for example hi=90 lo=80 ???
 
Last edited:

barouch

ADSM.ORG Member
#9
cancel all procees

Thank you all for your help !!
But nothing works!!!
The TSM is a WIN2003 server ,
A special need to stop at Least the reclamation process.
All other process usually not bother ...
there is no such command : CANCEL PROC ALL !!!! (TSM 5.3.x) .
Thanks
And please advice
bb
 

mateinone

ADSM.ORG Moderator
#10
Thank you all for your help !!
But nothing works!!!
The TSM is a WIN2003 server ,
A special need to stop at Least the reclamation process.
All other process usually not bother ...
there is no such command : CANCEL PROC ALL !!!! (TSM 5.3.x) .
Thanks
And please advice
bb
I will take a look later today if no one has created something in the meantime.
However i need to know if you want to set your recs and your stgpools back to a certain thresholds.

As mentioned, they are not going to do a can pr all. Because you would effectively have to reset pools to 100-99 and recs to 100 to pretty well guarantee that you were effectively stopping, if it was an out of the box script.

Anyway,

let me know your preferred thresholds and will see what I can do... would prefer it was bloody AIX though :p
 

chad_small

ADSM.ORG Moderator
#11
Canelling any reclaim or migration does not "KILL" the process immediately. TSM works by transaction points so it continues the process until the next transaction point and then closes out the process. This frustrates the hell out of a lot of admins, but it keeps data ingetrity and don't expect it to change. If you need to cancel a process by a certain time you need to give yourself some buffer time to allow the processes to finish and do cleanup before the stop.
 

moon-buddy

ADSM.ORG Moderator
#12
Since your TSM server is Windows based, try the batch file below:

------------------------------------------------------------------------------------
@echo off
IF EXIST OUT DEL OUT

dsmadmc -id=USERID -password=PASSWORD "q process" | findstr "Space Reclamation" | awk '{print $1}' > IN

GSAR -s, -r -f IN OUT

IF NOT EXIST OUT (
COPY IN OUT
) ELSE (
ECHO > NUL
)

for /F %%i in (OUT) do dsmadmc -id=USERID -password=PASSWORD "cancel process %%i"
-------------------------------------------------------------------------------------

As I mentioned before, you can create a list that is "tape process" specific and process through the list.

Google for GSAR and awk. These are windows based UNIX-equivalent commands that you have to place in c:\windows\system32

Works well for me. The batch file you have to create must be in c:\Program Files\Tivoli\TSM\baclient.
 
Last edited:

rulan

ADSM.ORG Member
#13
What should i use to cancel multiple processes.
I need to kill 3 processes at 5:00pm daily and I want to script it. With the help of this blog -- i can kill one process but not more than one. Can someone please help with that part of the script.
 

n9hmg

ADSM.ORG Senior Member
#14
rulan: Every example I've read (except MoonBuddy's first example, which was plainly a demo of how to get and cancel a single process, suitable for modification into your own scripting environment) cancels all processes.

Chad managed to get dos to do it in the post directly above yours. Further up, I do it with unix shell syntax using a for loop. Directly above that PJ does the same with a while loop(though not in a way I'd trust), and even mine left off discarding the stupid commas.
If you expect it to happen in pure tsm scripting, your expectation is going to go unmet.... at least in classic TSM. the db2 stuff in 6.1 probably lets you do some pretty flexible things.

You'll need to learn the rudiments of a scripting environment to understand the examples above, and to implement them for your own. I believe somebody's written perl modules for TSM. I personally was in too big a hurry and just scripted directly against the dsmadmc, using bourne syntax. MoonBuddy's wintel example above is impressive. When I've got to work from windows, I set up cygwin and use a real operating environment.
 

tmmckinn

ADSM.ORG Member
#15
Process priority should be at play here. If you need reclamation to make way for backups, the tsm server should give priority to the backup processes if tape resources are needed. If TSM deems it necessary, reclamation should be preempted for bacukps (I know this works for restore processes preempting reclamation processes).

If I read the documentation right, your server should process priority for resource clashes if preemption is enabled. Issue a QUERY OPT command on your admin command line. If the option NOPREEMPT = (No), then your backups should be able to preempt lower priority processes if tape drive contention occurs (assuming you are backing up directly to tape for some backups or just some files, instead of a random disk pool or a sequential disk pool).

Is reclamation called via an admin schedule? If so, you might be able to set priority. Default would be 5, it looks like. Lower priorities are more preemptable.
 
Last edited:

Samuel

ADSM.ORG Member
#16
Dear All,

I have more TSM Windows Server, and I need to reboot him one day per month for windows patchs. I finding a script to stop all TSM process and reboot the server.

If you have an idea, don't hesitate to contact me.

Thanks in advance.
 

rulan

ADSM.ORG Member
#17
C:
cd \
net stop "TSM Client Acceptor"
net stop "TSM Journal Service"
net stop "TSM Remote Client Agent"
net stop "TSM Scheduler"
net stop "TSM Client Scheduler"


When completed with reboot

net start "TSM Client Acceptor"
net start "TSM Client Scheduler"
 

rulan

ADSM.ORG Member
#19
Put this in a notepad and save the file as a .cmd file. you can then set this in chron to run with the scheduler

C:
cd \
net stop "TSM Client Acceptor"
net stop "TSM Journal Service"
net stop "TSM Remote Client Agent"
net stop "TSM Scheduler"
net stop "TSM Client Scheduler"
 

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 7 23.3%
  • Keep using TSM for Spectrum Protect.

    Votes: 16 53.3%
  • Let's be formal and just say Spectrum Protect

    Votes: 4 13.3%
  • Other (please comement)

    Votes: 3 10.0%

Forum statistics

Threads
30,888
Messages
131,415
Members
21,194
Latest member
jamesmacd40