1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

Script / Batch TSM

Discussion in 'Scripting' started by markino87, Jun 5, 2012.

  1. markino87

    markino87 New Member

    Joined:
    Apr 20, 2012
    Messages:
    11
    Likes Received:
    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?
     

    Attached Files:

  2.  
  3. mikeymac

    mikeymac Moderator

    Joined:
    Jun 20, 2003
    Messages:
    904
    Likes Received:
    27
    Location:
    Syracuse, NY
    Hi Markino!

    I would add a "wait=yes" to the 'delete filespace' command.
     
  4. chad_small

    chad_small Moderator

    Joined:
    Dec 17, 2002
    Messages:
    2,197
    Likes Received:
    43
    Occupation:
    AIX/SAN/TSM
    Location:
    Gilbert, AZ
    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.
     
  5. markino87

    markino87 New Member

    Joined:
    Apr 20, 2012
    Messages:
    11
    Likes Received:
    0
    tried with wait=yes, but doesn't work.
    I'm the only one that want to work easier with batch?
     
  6. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    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.
     
  7. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    21
    Likes Received:
    0
    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....
     
  8. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    Environment: Windows or UNIX?

    How would you know which nodes have been decommissioned? Indicator?
     
  9. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    21
    Likes Received:
    0
    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....
     
  10. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    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
     
  11. theja

    theja New Member

    Joined:
    Sep 7, 2011
    Messages:
    21
    Likes Received:
    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
     
  12. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    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.
     
  13. droach

    droach New Member

    Joined:
    Jan 7, 2008
    Messages:
    167
    Likes Received:
    3
    Occupation:
    I'm thinking...
    Location:
    Cut and Shoot, Texas
    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
    )
     
  14. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    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
     
  15. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,072
    Likes Received:
    269
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    This is OK but he needs to run on Linux.
     

Share This Page