Results 1 to 12 of 12
  1. #1
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 0 byte detection on dsmc backups

    Our management just gave us a new direction on supporting 0byte file backups...We're supposed to find all files backed up by the client and report them to the user to see if we should back them up or delete them off the tsm server. I'm a hardcore unix guy, and this would not be an issue, however, i have to do it on windows (xp to win7). Do you guys have any ideas using windows powershell or a .bat script to do this?

    inside of unix i would do something like this...

    /bin/sh

    CMD=${DSMCPATH}dsmc q backup | grep 0 bytes # very basic i know, just getting the point across
    for x in ${CMD}
    do
    echo "FILE ${X} is 0 bytes" | tee -a ${OUTPUT}
    done

    mailx -s "file - 0 bytes" tsmadmin@adsm.org < ${OUTPUT}


    Any ideas? I have never written a script in windows and have no clue...

  2. #2
    Moderator moon-buddy's Avatar
    Join Date
    Aug 2005
    Location
    Somewhere in the US
    Posts
    5,909
    Thanks
    4
    Thanked 231 Times in 226 Posts

    Default

    One way, and my lazy easy way out (no pun intended!):

    The Unix equivalent commands like grep, tail, etc can be used in Windows DOS scripts. These utilities have been ported for DOS use, and writing scripts similar to how Unix behaves in DOS is possible.

    Here is a link that has Unix commands for DOS: http://www.cyberciti.biz/faq/unix-co...s-for-windows/
    Ed

  3. #3
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I forgot to mention that this is on a government system, and cannot use anything like what was mentioned above...good old fashioned windows scripting is the only thing that I can use.

    Would TSM reporter have any of those features available?

  4. #4
    Moderator moon-buddy's Avatar
    Join Date
    Aug 2005
    Location
    Somewhere in the US
    Posts
    5,909
    Thanks
    4
    Thanked 231 Times in 226 Posts

    Default

    Quote Originally Posted by nextreme View Post
    Would TSM reporter have any of those features available?
    If you mean TSM OR (Operational Reporting) - not by default. You have to write one and it would not be easy. As you know OR is truly for the TSM server side reporting. Getting so info from the clients would require some skillful scripting and a lot of cross platform communication.

    In short, not worth your while to look at OR.

    You can use plain DOS scripts or Powershell.
    Ed

  5. #5
    Moderator Harry_Redl's Avatar
    Join Date
    Dec 2003
    Location
    Czech Republic
    Posts
    2,227
    Thanks
    4
    Thanked 100 Times in 99 Posts

    Default

    Hi,

    although it is not widely known, Windows system have equivalent of grep - it is called "findstr" - see "findstr /?" for details.
    You can start with this:
    Code:
    dsmc q ba * -sub=yes | findstr /C:" 0  B"
    Harry

  6. #6
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So here's the script, and it works on the command line, but it's horked in a .bat script. Any ideas? The issue is when I try and parse the dsmc output...

    @echo off
    SET CURRENTTIME=%TIME%
    IF "%CURRENTTIME:~0,1%"==" " (SET CURRENTTIME=0%CURRENTTIME:~1%)
    FOR /F "tokens=2-4 delims=/ " %%A IN ('DATE /T') DO (SET TIMESTAMP=%%C-%%A-%%B %CURRENTTIME%)
    echo %CURRENTTIME%

    set OUTPUT=F:\FILES\0byteOUTPUT_%CURRENTTIME%.txt

    F:

    cd \"Program Files"\Tivoli\TSM\baclient\

    dsmc q backup f:\* -subdir=yes '| findstr /C:" 0 B" > \FILES\0byteOUTPUT_%CURRENTTIME%.txt'

    cd \FILES

  7. #7
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by nextreme View Post
    So here's the script, and it works on the command line, but it's horked in a .bat script. Any ideas? The issue is when I try and parse the dsmc output...

    @echo off
    SET CURRENTTIME=%TIME%
    IF "%CURRENTTIME:~0,1%"==" " (SET CURRENTTIME=0%CURRENTTIME:~1%)
    FOR /F "tokens=2-4 delims=/ " %%A IN ('DATE /T') DO (SET TIMESTAMP=%%C-%%A-%%B %CURRENTTIME%)
    echo %CURRENTTIME%

    set OUTPUT=F:\FILES\0byteOUTPUT_%CURRENTTIME%.txt

    F:

    cd \"Program Files"\Tivoli\TSM\baclient\

    dsmc q backup f:\* -subdir=yes | findstr /C:" 0 B" > \FILES\0byteOUTPUT_%CURRENTTIME%.txt

    cd \FILES
    Here's the output...

    F:\FILES>0byte.bat
    08:31:02.18
    The filename, directory name, or volume label syntax is incorrect.

  8. #8
    Moderator moon-buddy's Avatar
    Join Date
    Aug 2005
    Location
    Somewhere in the US
    Posts
    5,909
    Thanks
    4
    Thanked 231 Times in 226 Posts

    Default

    Try this:

    F:
    cd \"Program Files"\Tivoli\TSM\baclient\ ***I presume this directory is in F: rather than C:? ***
    dsmc q backup f:\* -subdir=yes | findstr /C:" 0 B" >> F:\FILES\0byteOUTPUT_%CURRENTTIME%.txt
    cd F:\FILES
    Ed

  9. #9
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    because of the different client versions, i have to make it work w/5.5 first, then upgrade it to 6.3 (client). So I installed the client of 5.5 to F:\blah...

    With the redirection, i'm still hitting the error.


    Quote Originally Posted by moon-buddy View Post
    Try this:

    F:
    cd \"Program Files"\Tivoli\TSM\baclient\ ***I presume this directory is in F: rather than C:? ***
    dsmc q backup f:\* -subdir=yes | findstr /C:" 0 B" >> F:\FILES\0byteOUTPUT_%CURRENTTIME%.txt
    cd F:\FILES

  10. #10
    Moderator moon-buddy's Avatar
    Join Date
    Aug 2005
    Location
    Somewhere in the US
    Posts
    5,909
    Thanks
    4
    Thanked 231 Times in 226 Posts

    Default

    Change %CURRENTTIME% to %TIME%
    Ed

  11. #11
    Moderator Harry_Redl's Avatar
    Join Date
    Dec 2003
    Location
    Czech Republic
    Posts
    2,227
    Thanks
    4
    Thanked 100 Times in 99 Posts

    Default

    Hi,

    this works for me
    Code:
    @echo off
    For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
    For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
    echo %mydate%_%mytime%
    
    set OUTPUT=c:\0byteOUTPUT_%mydate%_%mytime%.txt
    cd \"Program Files"\Tivoli\TSM\baclient\
    dsmc q ba * -sub=yes | findstr /C:" 0  B" > %OUTPUT%
    cd \
    note that there are two spaces between "0" and "B" in the "findstr" command

    Harry

  12. #12
    Newcomer
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Finally got it:

    First script calls the second script:

    Here's the run me script:
    ================================================== =====================

    @echo off

    set HOST=%ComputerName%


    :: Datestamp (8 digets)
    for /f "tokens=2-4 skip=1 delims=(-./)" %%i in ('echo.^|date') do (
    for /f "tokens=1-4 delims=-./ " %%m in ('date /t') do (
    (set dow=%%m)&(set %%i=%%n)&(set %%j=%%o)&(set yyyy=%%p)))
    Set "mydate=%yyyy%_%mm%_%dd%"


    echo ###################################### > F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt
    echo # Start of Collection for %HOST% >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt
    echo ###################################### >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt

    echo\ >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt
    echo Script ran on %mydate% >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt
    echo\ >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt

    f:\FILES\0byte.bat >> F:\FILES\OUTPUT\output_for_0byte_%HOST%_%mydate%.t xt

    ================================================== =====================

    Here's the 0byte.bat script

    ================================================== =====================
    @echo off
    SET CURRENTTIME=%TIME%
    IF "%CURRENTTIME:~0,1%"==" " (SET CURRENTTIME=0%CURRENTTIME:~1%)
    FOR /F "tokens=2-4 delims=/ " %%A IN ('DATE /T') DO (SET TIMESTAMP=%%C-%%A-%%B %CURRENTTIME%)

    echo %CURRENTTIME%

    set OUTPUT=F:\FILES\OUTPUT_%CURRENTTIME%.txt

    F:

    cd \"Program Files"\Tivoli\TSM\baclient
    dsmc q backup f:\* -subdir=yes | findstr /C:" 0 B"


    cd \FILES

    ================================================== =====================


    Now all i have to do is write a perl roll up script...will post that also when i'm done...

Similar Threads

  1. Query Filespace: Win2008 and back systemstate display 0 byte
    By cyberZ in forum Backup / Archive Discussion
    Replies: 1
    Last Post: 09-21-2011, 06:37 AM
  2. Replies: 8
    Last Post: 01-26-2010, 06:18 AM
  3. bkup sw detection
    By kwesi in forum Others
    Replies: 1
    Last Post: 11-10-2009, 12:34 PM
  4. Lan Free backup Byte Sent Report
    By tsmsm in forum TSM Reporting & Monitoring
    Replies: 1
    Last Post: 01-29-2004, 02:59 PM
  5. Export/Import node filespace file/byte count discrepancy
    By tritter1957 in forum Backup / Archive Discussion
    Replies: 0
    Last Post: 12-13-2002, 04:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •