ADSM-L

Re: Script to cancel certain sessions

2001-11-29 11:36:36
Subject: Re: Script to cancel certain sessions
From: David McClelland <DAVIDMCCLELLAND AT UK.IBM DOT COM>
Date: Thu, 29 Nov 2001 16:26:04 +0000
Niklas/Dwight,

Assuming you're using a UNIX box, here's some things to make this simpler:

o) If you put a '-comma' after your -id=xxxx -pass=xxxx then you won't
split accross two lines when you get to big sessno's.

o) Also, probably simpler to 'sed' out the ',' using a 'sed s/,//g'

Using this, we get:

#!/bin/ksh
for i in `dsmadmc -id=XXXX -passw=XXXX -comma q se | grep $1 | grep
^\"[0-9] | sed s/,//g | cut -d'"' -f2`
do
     echo "dsmadmc -id=XXXX -passw=XXXX can se $i"
done

This would give a list of numbers of sessions belonging to a parameter that
you pass into this script. I've put an 'echo' just so you don't blat the
wrong session to begin with. When you're happy it works, wipe out the echo"
dsmadmc ... can se $i" and you're away!

So, a :

./my_script NT_CLIENTS

would kill off all of your naughty NT client sessions which were left
hanging around - not a bad thing at all! Any offers?

Rgds,

David McClelland
---------------------------
Tivoli Storage Management Team
Tivoli Storage Management Team
IBM EMEA Technical Centre,
Internet: davidmcclelland AT uk.ibm DOT com



"Cook, Dwight E (SAIC)" <cookde AT BP DOT COM>@VM.MARIST.EDU> on 29/11/2001
14:45:34

Please respond to "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>

Sent by:  "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>


To:   ADSM-L AT VM.MARIST DOT EDU
cc:
Subject:  Re: Script to cancel certain sessions




Well, just remember that if you want to cancel either a  session or a
process, you can't have any commas in the number so you can't just  do a
query & cut the number out.
Here is an example of how I deal with process  numbers

#!/bin/ksh
for PROCNUM in $(dsmadmc -id=someid  -pass=somepass q pro | cut -c1-8 |
grep ^' ' | grep [0-9]
grep ^' ' | grep [0-9]
do
   echo $PROCNUM | grep , 1>/dev/null  2>&1
   if [ $? -eq 0 ] ;  then
      FIRST=$(echo $PROCNUM | cut -d','  -f1)
      SECOND=$(echo $PROCNUM | cut -d','  -f2)
       PROCNUM=$FIRST$SECOND
      fi
echo    dsmadmc -id=someid -pass=somepass cancel process  $PROCNUM
done
exit

so  just change the above to do a "q session" and grep for your node
name(s) and cut  the first 6 characters and use that to cancel the
sessions....
now if  your sessions get above 99,999 you will have problems because the
session number  itself will be across two lines of output...


hope  this helps
later
dwight
<Prev in Thread] Current Thread [Next in Thread>