[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

06/14/2005 at 04:53AM PDT, ID: 21457271
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

ntbackup batch script problem

Asked by omb in Windows 2000 Operating System

Tags: ntbackup, blat, errorlevel, script, batch

We use NTBACKUP, run each evening, as a cheap solution to backups. We have created, with the help of EE member pbarrette (see question http://www.experts-exchange.com/Operating_Systems/Win2000/Q_20921686.html) a script which runs ntbackup & emails the status of the ntbackup job. However, the subject & description of the emails never changes, eventhough there could be problems. FYI, the original script backed up to tape (4mm), this script backs up to external USB hard disks. We also use a German OS, hence the funny German words!

I believe the :CHECKLOGFORERRORS part of the script is the problem. The script always gives a Subj of "%computername% Sicherung Erfolgreich abgeschlossen" and Desc of "Backup ran OK for %computername% at %USERDOMAIN% on" - eventhough, this may not be the case i.e. I have manually stopped the script, checked the log which has the string "Benutzer abgebrochen" within, but the script does not change the Subj or Desc variables.

Here is the script, any ideas?:

========= paste ===========

set blat=c:\downloads\blat\blat.exe
set Recipient=backup@domain.com
set Subj="%computername% Sicherung Erfolgreich abgeschlossen"
set Desc=Backup ran OK for %computername% at %USERDOMAIN% on
set Subj1="%computername% Sicherung mit Ausnahmen abgeschlossen"
set Subj2="%computername% Sicherung abgebrochen"
set Subj3="%computername% Sicherung mit Ausnahmen abgeschlossen"
set Subj4="%computername% Sicherung abgebrochen"
set Desc1=Problems with Exchange backup on %computername% at %USERDOMAIN% on
set Desc2=No external hard disk found on %computername% at %USERDOMAIN% on
set Desc3=Problems with the hard disk found on %computername% at %USERDOMAIN% on
set Desc4=Backup broken up by user on %computername% at %USERDOMAIN% on
set ntbackup=C:\WINNT\system32\NTBACKUP.EXE
set LOGDIR=%USERPROFILE%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Windows NT\NTBackup\data
set blatErrorFile="%temp%\%random%%random%.txt"
set blatTEMPfile="%temp%\%random%%random%.txt"

for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j%%k%%l
for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
set dtt=%dt%%tm%

for %%a in (V W X Y) do if exist %%a:\ set BackupJob=%%a.bks

if /i "%BackupJob%"=="V.bks" (
  set jobDescription=Voll Sicherung Montag bis Freitag
  set DriveLetter=V
)

if /i "%BackupJob%"=="W.bks" (
  set jobDescription=Freitag Sicherung
  set DriveLetter=W
)

if /i "%BackupJob%"=="X.bks" (
  set jobDescription=Montag und Mittwoch Sicherung
  set DriveLetter=X
)

if /i "%BackupJob%"=="Y.bks" (
  set jobDescription=Dienstag und Donnerstag Sicherung
  set DriveLetter=Y
)

:RUNBACKUP
%ntbackup% backup "@c:\scripts\backup\%BackupJob%" /n "%computername%-%dtt%" /d "%jobDescription%" /v:no /r:no /rs:no /m normal /j "%computername% voll Sicherung" /l:s /f "%DriveLetter%:\IHG-WTS & SV01.bkf"

:CHECKLOGFORERRORS
FOR /F %%F IN ('DIR /B /A-D /OD /TW "%LOGDIR%\Backup??.log"') DO (
 SET LOGFILE=%%F
)

ECHO "%LOGDIR%\%LOGFILE%" | FINDSTR /C:"beschädigt oder unvollständig" > NUL
IF NOT ERRORLEVEL 1 (
 set Subj=%Subj1%
 set Desc=%Desc1%
 GOTO BLAT
)

ECHO "%LOGDIR%\%LOGFILE%" | FINDSTR /C:"Medien nicht gefunden wurden" > NUL
IF NOT ERRORLEVEL 1 (
 set Subj=%Subj2%
 set Desc=%Desc2%
 GOTO BLAT
)

ECHO "%LOGDIR%\%LOGFILE%" | FINDSTR /C:"Gerät meldete einen Fehler" > NUL
IF NOT ERRORLEVEL 1 (
 set Subj=%Subj3%
 set Desc=%Desc3%
 GOTO BLAT
)

ECHO "%LOGDIR%\%LOGFILE%" | FINDSTR /C:"Benutzer abgebrochen" > NUL
IF NOT ERRORLEVEL 1 (
 set Subj=%Subj4%
 set Desc=%Desc4%
 GOTO BLAT
)

:BLAT
echo %Desc% %dtt% > %blatTEMPfile%
%blat% %blatTEMPfile% -to %Recipient% -s %Subj% -attach "%LOGDIR%\%LOGFILE%"
del /q /f "%blatTEMPfile%"
goto :EOF

:EOF
exit

========= paste ===========
 
Keywords: ntbackup batch script problem
 
Loading Advertisement...
 
[+][-]06/14/05 04:36 PM, ID: 14216908

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Windows 2000 Operating System
Tags: ntbackup, blat, errorlevel, script, batch
Sign Up Now!
Solution Provided By: pbarrette
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06/14/05 04:50 PM, ID: 14216997

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/15/05 01:15 AM, ID: 14218601

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/15/05 12:40 PM, ID: 14225103

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/21/05 12:06 AM, ID: 14263505

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91