It is possible to remove single characters or sections from a string using
SED too; I tend to do this,
If you have a sessnum of 1,483
sessnum=$(echo ${sessnum} | sed -e 's/,//g')
will remove the ','
The sed command in that line substitutes everything after the first '/' with
everything after the second '/' upto the third '/'
Matt.
-----Original Message-----
From: Cook, Dwight E (SAIC) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 2:46 PM
To: [EMAIL PROTECTED]
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