IBM Support

Script to cancel client session based on node name

Troubleshooting


Problem

This document provides sample scripts that can be used to cancell all Tivoli Storage Manager associated to a specific node name.

Resolving The Problem

The below scripts are provided as-is and unsupported.

In the case where the Tivoli Storage Manager administrator client runs on unix, the below sample can be used.
cancel_sess.sh :

#!/bin/ksh
########################################################################
#
# This script will cancel all Tivoli Storage Manager client sessions
# for a specific node name.
#
# The script accepts 3 arguments,
# 1. The Tivoli Storage Manager administrator userid
# 2. The Tivoli Storage Manager administrator password
# 3. The Tivoli Storage Manager client node name (in uppercase)
# for which sessions should be cancelled.
#
########################################################################

tsmid=$1
tsmpa=$2
tsmnode=$3

for session in $(dsmadmc -id=$tsmid -pa=$tsmpa "select 'TSMCMD', session_id from sessions where CLIENT_NAME='$tsmnode'" | grep '^TSMCMD' | cut -b 8-) ; do dsmadmc -id=$tsmid -pa=$tsmpa "cancel sess ${session} " ; done


In the case where the Tivoli Storage Manager administrator client runs on Windows, the below sample can be used.
cancel_sess.cmd :

@echo off
rem ********************************************************************
rem *
rem * This command file will cancel all Tivoli Storage Manager client
rem * sessions for a specific node name.
rem
rem * The script accepts 3 arguments :
rem * 1. The Tivoli Storage Manager administrator userid
rem * 2. The Tivoli Storage Manager administrator password
rem * 3. The Tivoli Storage Manager client node name (in uppercase)
rem * for which sessions should be cancelled.
rem *
rem ********************************************************************

SET TSMID=%1
SET TSMPA=%2
SET TSMNODE=%3
SET TSMCMD="dsmadmc -id="%TSMID%" -pa="%TSMPA%" -dataonly=yes select session_id from sessions where CLIENT_NAME='"%TSMNODE%"'"

For /F %%N in ('%TSMCMD%') do dsmadmc -id=%TSMID% -pa=%TSMPA% cancel session %%N

[{"Product":{"code":"SSGSG7","label":"Tivoli Storage Manager"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Server","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Supported Versions","Edition":"","Line of Business":{"code":"LOB26","label":"Storage"}}]

Document Information

More support for:
Tivoli Storage Manager

Software version:
All Supported Versions

Document number:
230877

Modified date:
17 June 2018

UID

swg21647098