Results 1 to 12 of 12
Thread: 0 byte detection on dsmc backups
-
06-09-2012, 09:13 PM #1Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
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...
-
06-09-2012, 09:57 PM #2Moderator
- Join Date
- Aug 2005
- Location
- Somewhere in the US
- Posts
- 5,354
- Thanks
- 2
- Thanked 148 Times in 145 Posts
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
-
06-10-2012, 10:53 AM #3Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
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?
-
06-10-2012, 11:16 AM #4Moderator
- Join Date
- Aug 2005
- Location
- Somewhere in the US
- Posts
- 5,354
- Thanks
- 2
- Thanked 148 Times in 145 Posts
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
-
06-10-2012, 11:30 AM #5Moderator
- Join Date
- Dec 2003
- Location
- Czech Republic
- Posts
- 2,056
- Thanks
- 2
- Thanked 59 Times in 58 Posts
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:
HarryCode:dsmc q ba * -sub=yes | findstr /C:" 0 B"
-
06-12-2012, 11:29 AM #6Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
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
-
06-12-2012, 11:31 AM #7Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
06-12-2012, 11:35 AM #8Moderator
- Join Date
- Aug 2005
- Location
- Somewhere in the US
- Posts
- 5,354
- Thanks
- 2
- Thanked 148 Times in 145 Posts
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:\FILESEd
-
06-12-2012, 12:12 PM #9Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
06-12-2012, 01:01 PM #10Moderator
- Join Date
- Aug 2005
- Location
- Somewhere in the US
- Posts
- 5,354
- Thanks
- 2
- Thanked 148 Times in 145 Posts
Change %CURRENTTIME% to %TIME%
Ed
-
06-12-2012, 03:32 PM #11Moderator
- Join Date
- Dec 2003
- Location
- Czech Republic
- Posts
- 2,056
- Thanks
- 2
- Thanked 59 Times in 58 Posts
Hi,
this works for me
note that there are two spaces between "0" and "B" in the "findstr" commandCode:@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 \
Harry
-
06-12-2012, 04:16 PM #12Newcomer
- Join Date
- Jun 2012
- Posts
- 10
- Thanks
- 0
- Thanked 0 Times in 0 Posts
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
-
Query Filespace: Win2008 and back systemstate display 0 byte
By cyberZ in forum Backup / Archive DiscussionReplies: 1Last Post: 09-21-2011, 06:37 AM -
Byte count mismatch for object during reclamation process
By major in forum TSM OperationReplies: 8Last Post: 01-26-2010, 06:18 AM -
bkup sw detection
By kwesi in forum OthersReplies: 1Last Post: 11-10-2009, 12:34 PM -
Lan Free backup Byte Sent Report
By tsmsm in forum TSM Reporting & MonitoringReplies: 1Last Post: 01-29-2004, 02:59 PM -
Export/Import node filespace file/byte count discrepancy
By tritter1957 in forum Backup / Archive DiscussionReplies: 0Last Post: 12-13-2002, 04:06 PM


Reply With Quote
