NTbackup problem


S

stijn.calders

Hi,

I use this batch script as a scheduled task to make tape backups of a
Windows 2003 server:

del backup*.log
@echo off
Set [email protected]
Set MAILHOST=our_mailserver
start /wait c:\windows\system32\rsm.exe refresh /LF"Compaq AIT 35 GB
LVD drive"
sleep 30
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dd=%%i-%%j-%%k-
%%l
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%l-%%k-%%j-
%%i
for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
set tm=%tm::=-%
Set dt=%dt%
set dtt=%dd%%tm%
gbmail -to %MAILTO% -s Backup_is_started_on_SAWADM02 -h %MAILHOST%
c:\windows\system32\ntbackup.exe backup "@D:\Jobs\busawadm02.bks" /d
"daily %dtt%" /v:no /r:no /rs:no /hc:blush:n /m normal /j "daily %dtt%" /
l:f /p "8mm AIT1" /UM
c:\windows\system32\rsm.exe eject /PF"%computername%-%dtt% - 1" /
astart
find "Backup completed" backup*.log
if errorlevel 1 goto end1a
echo BACKUP SAWADM02 logfile werd aangemaakt > gelukt.txt
gbmail -to %MAILTO% -cc %MAILCC% -file gelukt.txt -s
Backup_finished_successfully_on_SAWADM02 -h %MAILHOST%
goto end1b
:end1a
echo BACKUP SAWADM02 MISLUKT > mislukt.txt
gbmail -to %MAILTO% -cc %MAILCC% -file mislukt.txt -s
Backup_failed_on_SAWADM02 -h %MAILHOST%
:end1b
rename backup*.log %computername%-%dt%.log

This script worked before I reinstalled the server. After
reinstallation, the scheduled job fails to backup the data without
writing an error in the log file. If I run this script interactively,
the backup goes fine!
Does someone know why the scheduled job fails and has a solution for
this problem?

Many thanks in advance,
Stijn Calders
 
Ad

Advertisements

P

Pegasus \(MVP\)

Hi,

I use this batch script as a scheduled task to make tape backups of a
Windows 2003 server:

del backup*.log
@echo off
Set [email protected]
Set MAILHOST=our_mailserver
start /wait c:\windows\system32\rsm.exe refresh /LF"Compaq AIT 35 GB
LVD drive"
sleep 30
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dd=%%i-%%j-%%k-
%%l
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%l-%%k-%%j-
%%i
for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
set tm=%tm::=-%
Set dt=%dt%
set dtt=%dd%%tm%
gbmail -to %MAILTO% -s Backup_is_started_on_SAWADM02 -h %MAILHOST%
c:\windows\system32\ntbackup.exe backup "@D:\Jobs\busawadm02.bks" /d
"daily %dtt%" /v:no /r:no /rs:no /hc:blush:n /m normal /j "daily %dtt%" /
l:f /p "8mm AIT1" /UM
c:\windows\system32\rsm.exe eject /PF"%computername%-%dtt% - 1" /
astart
find "Backup completed" backup*.log
if errorlevel 1 goto end1a
echo BACKUP SAWADM02 logfile werd aangemaakt > gelukt.txt
gbmail -to %MAILTO% -cc %MAILCC% -file gelukt.txt -s
Backup_finished_successfully_on_SAWADM02 -h %MAILHOST%
goto end1b
:end1a
echo BACKUP SAWADM02 MISLUKT > mislukt.txt
gbmail -to %MAILTO% -cc %MAILCC% -file mislukt.txt -s
Backup_failed_on_SAWADM02 -h %MAILHOST%
:end1b
rename backup*.log %computername%-%dt%.log

This script worked before I reinstalled the server. After
reinstallation, the scheduled job fails to backup the data without
writing an error in the log file. If I run this script interactively,
the backup goes fine!
Does someone know why the scheduled job fails and has a solution for
this problem?

Many thanks in advance,
Stijn Calders

Your script assumes that the backup log resides in the current
directory. This is incorrect. You should code your batch file
like so:

cd /d "%UserProfile%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data"
echo F | xcopy /d *.log" "%temp%\Backup.log"

The above code resolves the problem of working out
which backup log is the most recent log file. Your line
of code
rename backup*.log %computername%-%dt%.log
will fail consistently when there is more than one log
file, which is highly likely.
 
S

stijn.calders

Your script assumes that the backup log resides in the current
directory. This is incorrect. You should code your batch file
like so:

cd /d "%UserProfile%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data"
echo F | xcopy /d *.log" "%temp%\Backup.log"

The above code resolves the problem of working out
which backup log is the most recent log file. Your line
of code
rename backup*.log %computername%-%dt%.log
will fail consistently when there is more than one log
file, which is highly likely.- Tekst uit oorspronkelijk bericht niet weergeven -

It's true what you're saying, but it doesn't help me to correct this
problem. If I check the backup*.log file of the last backup, this file
is empty. So NTBackup starts, but fails to make the backup without
writing an error to the log file. My question is: why does NTBackup
fail in this scheduled job, but doesn't if I run this interactively?

Thanks,
Stijn.
 
P

Pegasus

It's true what you're saying, but it doesn't help me to correct this
problem. If I check the backup*.log file of the last backup, this file
is empty. So NTBackup starts, but fails to make the backup without
writing an error to the log file. My question is: why does NTBackup
fail in this scheduled job, but doesn't if I run this interactively?

Thanks,
Stijn.

You backup job is probably waiting for some response
for you. In other words, it is still running when you check
the log file. That's why the file is empty! Maybe ntbackup
is asking for some password when backing up folders for
which the current user has no access rights. You can check
this like so:

echo %date% %time% Before the backup command > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
ntbackup /.. /.. 1>>c:\test.log 2>>&1
echo ErrorLevel of NTBackup=%ErrorLevel% >> c:\test.log
echo %date% %time% End of ntbackup >> c:\test.log

Schedule this job, then have a look at c:\test.log. I suspect
that it will tell you a great deal.

BTW, what files or folders are in your selection list?
 
S

stijn.calders

This is the result:

di 22/05/2007 21:59:34,09 Before the backup command
User=administrator, Path=C:\Program Files\Windows Resource Kits\Tools
\;C:\Program Files\Support Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:
\WINDOWS\System32\Wbem
ErrorLevel of NTBackup=87
di 22/05/2007 21:59:37,17 End of ntbackup

Any idea what errorlevel 87 means?

Thanks,
Stijn.
 
P

Pegasus

ErrorLevel 87 is generated by ntbackup.exe. I do not
know what it means but I suspect it's an access problem.
Since you chose not to tell us what's in your selection
list, it is not possible to say anything else.
 
Ad

Advertisements

Joined
Jan 3, 2012
Messages
1
Reaction score
0
Hi,

I have another question. I just found that the tape was not ejected automatically after the backup was completed for few days. The backup batch as below.

C:\WINDOWS\system32\rsm.exe refresh /LG0FCD0A66F42E440E90166122A7E1A2A0
C:\WINDOWS\system32\ping.exe -n 6 localhost >nul
Set media=for /f "Skip=2 Tokens=*" %%a in ('rsm view /cg0FCD0A66F42E440E90166122A7E1A2A0 /tphysical_media') do if not "%%a"=="The command completed successfully." set media="%%a"
if not defined media goto notape
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 tm=%tm: :=-%
set dtt=%dt%%tm%
C:\WINDOWS\system32\NTBACKUP.EXE backup "@C:\Backup\Backup Apps.bks" /n "Daily %dtt%" /d "Daily %dtt%" /v:yes /r:no /rs:no /hc:blush:n /m normal /j "%dtt%" /l:f /p "LTO Ultrium" /UM
C:\WINDOWS\system32\rsm.exe eject /PF"Daily %dtt% - 1" /astart
exit
:notape
exit


Please help to solve this and thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top