Script to cancel all process

barouch

ADSM.ORG Member
Joined
Apr 23, 2007
Messages
14
Reaction score
0
Points
0
PREDATAR Control23

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:
 
PREDATAR Control23

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:
PREDATAR Control23

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
 
PREDATAR Control23

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..
 
PREDATAR Control23

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.
 
PREDATAR Control23

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.
 
PREDATAR Control23

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:
PREDATAR Control23

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:
PREDATAR Control23

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
 
PREDATAR Control23

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
 
PREDATAR Control23

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.
 
PREDATAR Control23

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:
PREDATAR Control23

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.
 
PREDATAR Control23

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.
 
PREDATAR Control23

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:
PREDATAR Control23

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.
 
PREDATAR Control23

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"
 
PREDATAR Control23

I'm not a specialist of Windows, but how do you do to put theses in the windows crontab ?
 
PREDATAR Control23

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"
 
Top