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 IBM EMEA Technical Centre, Internet: [EMAIL PROTECTED] "Cook, Dwight E (SAIC)" <[EMAIL PROTECTED]>@VM.MARIST.EDU> on 29/11/2001 14:45:34 Please respond to "ADSM: Dist Stor Manager" <[EMAIL PROTECTED]> Sent by: "ADSM: Dist Stor Manager" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] 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] 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 -----Original Message----- From: Niklas Lundstrom [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 6:29 AM To: [EMAIL PROTECTED] Subject: Script to cancel certain sessions Hello TSM:ers I'm trying to write a script that should cancel the sessions for certain servers if their backup still runs at 9 am but I'm stuck. How can I do that? It should be automated by a command script. Regards Niklas Lundström Föreningssparbanken IT 08-5859 5164