Script / Batch TSM

markino87

ADSM.ORG Member
Joined
Apr 20, 2012
Messages
16
Reaction score
1
Points
0
Hi, would be nice to open a new thread, which includes various scripts for Batch tsm.
I'm beginning.

This script is for deleting nodes and related spaces, "incomplete" but because if tsm takes longer than expected elimination remove the node fails.
Is anyone able to improve it?
 

Attachments

  • delete_node.txt
    379 bytes · Views: 182
I concur with mikeymac, you need to add wait=yes or else the command to delete the node will try to run before the data is removed and you will fail the node removal.
 
tried with wait=yes, but doesn't work.
I'm the only one that want to work easier with batch?
 
tried with wait=yes, but doesn't work.
I'm the only one that want to work easier with batch?

I don't think so.

We work with batch and scripts to do daily TSM Admin work but, personally, I don't batch/script node deletes as this happens too seldom. If ever I batch them - if there are a handful to delete - I will delete the filespaces first then the node itself much, much later.
 
Hello Moon-buddy,

even I am looking for the script which search for the nodes which are decommissioned and delete the FS and remove the node from TSM, could you please help here....
 
We are running Tsm 6.3 on Linux, we identify the decommission nodes by a format below... nodename-keep90.... Nodes may be from any platform....
 
This script deletes the file spaces. After deleting, create a script to delete the node.

#!/bin/ksh

COMD="dsmadmc -id=<admin_id> -pa=<password> -noc -dataonly=yes"

rm -f node_lst

$COMD="select node_name from nodes where node_name like '%KEEP90'" >> node_lst

for i in `cat node_lst`
do
$COMD "delete filespace $i *"
done

exit 0
 
Hello Moon buddy,

Thank you for the script.. I have modified the script to give me the last access time..

not sure about the last access time as my scenario is to delete the keep90 nodes which are not accessed from past 90days..

Please let me know if the below script will delete the keep90 nodes which are not accessed from past 90 days..

#!/bin/ksh
COMD="dsmadmc -id=<admin_id> -pa=<password> -noc -dataonly=yes"
rm -f node_lst
$COMD="select node_name, LASTACC_TIME from nodes where node_name like '%KEEP90'" >> node_lst
for i in `cat node_lst`
do
$COMD "delete filespace $i *"
done
exit 0
 
Why do you need the last access time when you are sure that you are deleting those that were accessed 90 days ago?

You will need this only to verify which you would need to modify the script to confirm that last access was more than 90 days ago.
 
This is what I use. Put a list of nodes in a text file called 'deleteFilespace.txt' and then run it. It assumes you are using the 'admin' account.

@echo off
:: ------ Delete filespaces and remove node from TSM
:: ------ Pass the TSM server node name as param 1 and password as 2
::
:: ------ example myserver mypassword
::
:: ------ EDIT THE LOGINPARAMS PARAMETER
set LOGINPARAMS=-id=admin -password=%2%
set DATAONLY=-dataonly=yes
set ADMCPARAMS=-DISPLAYMODE=list %DATAONLY%
set tsmhost=-tcps=%1

FOR /f "delims=," %%A IN (deleteFileSpace.txt) DO (
echo .
echo Working on %%A
echo .
dsmadmc %LOGINPARAMS% %tsmhost% del files %%A * wait=y
dsmadmc %LOGINPARAMS% %tsmhost% rem node %%A
)
 
Hello Moon buddy,

Thank you for the script.. I have modified the script to give me the last access time..

not sure about the last access time as my scenario is to delete the keep90 nodes which are not accessed from past 90days..

Please let me know if the below script will delete the keep90 nodes which are not accessed from past 90 days..

#!/bin/ksh
COMD="dsmadmc -id=<admin_id> -pa=<password> -noc -dataonly=yes"
rm -f node_lst
$COMD="select node_name, LASTACC_TIME from nodes where node_name like '%KEEP90'" >> node_lst
for i in `cat node_lst`
do
$COMD "delete filespace $i *"
done
exit 0

You can re-write this if you need to test for last access date > 90 days:

#!/bin/ksh
COMD="dsmadmc -id=<admin_id> -pa=<password> -noc -dataonly=yes"
rm -f node_lst
$COMD="select node_name from nodes where node_name like '%KEEP90' and lastacc_time<timestamp(current_date)-(90)days" >> node_lst
for i in `cat node_lst`
do
$COMD "delete filespace $i *"
done
exit 0
 
This is what I use. Put a list of nodes in a text file called 'deleteFilespace.txt' and then run it. It assumes you are using the 'admin' account.

@echo off
:: ------ Delete filespaces and remove node from TSM
:: ------ Pass the TSM server node name as param 1 and password as 2
::
:: ------ example myserver mypassword
::
:: ------ EDIT THE LOGINPARAMS PARAMETER
set LOGINPARAMS=-id=admin -password=%2%
set DATAONLY=-dataonly=yes
set ADMCPARAMS=-DISPLAYMODE=list %DATAONLY%
set tsmhost=-tcps=%1

FOR /f "delims=," %%A IN (deleteFileSpace.txt) DO (
echo .
echo Working on %%A
echo .
dsmadmc %LOGINPARAMS% %tsmhost% del files %%A * wait=y
dsmadmc %LOGINPARAMS% %tsmhost% rem node %%A
)

This is OK but he needs to run on Linux.
 
Back
Top