Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 643
  • Last Modified:

NT Backup Command

"I schedule a NT Backup bat file for my Server as the following command, Anyone please check anything wrong with my command line?"

Ntbackup backup T:\ /d "Daily Backup" /hc:off /t incremental /l "DailyBackup" /e

if errorlevel 4 goto errorlevel4
if errorlevel 3 goto abortlevel3
if errorlevel 2 goto conflictlevel2
if errorlevel 1 goto no_fileslevel1
if errorlevel 0 goto successlevel0

:errorlevel4
echo Backup stopped the process due to an error
goto exit
:abortlevel3
echo You just pressed CTRL+C to stop the backup
goto exit
:conflictlevel2
echo One or more files were not backed up due to a sharing conflict
goto exit
:no_fileslevel1
echo Sorry, but there were no files to backup
goto exit
:successlevel0
echo The backup was successful
goto exit
:exit

"Note: Who know what wrong with the above command? when I run the bat file it worked, but it will auto close after few minute. For the Log file part, where the log file save to?"

"Thank you!"
0
geoffry
Asked:
geoffry
  • 2
1 Solution
 
arminlCommented:
Hi,

I am not quite sure what you mean when you say "it will auto close after few minute", but I assume that the backup procedure may start, but the batch file probably will not wait for the end but terminate prematurely with an errorlevel of 0? Am I right? Or is there any thing else aou haven't mentioned, e.g. are you trying to run the batch through the at command or another time scheduling program?

If the first case applies, try to run ntbackup using the

start /wait

command (see start /?) for details. This schould make the batch file wait for ntbackup to end before going on. I haven't checked this though, I thought batches would wait for .exe files to terminate by default, but I can also be wrong ...

Armin Linder
0
 
Tim HolmanCommented:
The logfile will end up whereever the user executed the batch file from.
eg - if you're at the C:\ prompt, log file will go there.
If backup is incremental, then it will backup only changed files.  If this is quick, then maybe there haven't been many file changes ?

0
 
geoffryAuthor Commented:
Hi! Armin Linder,
I agree what u have said. I tried to "rem" all the error coding as below it doesn't work as well, & also I am very sure there is no other schedule runing at that time;

Ntbackup backup T:\ /d "Daily Backup" /hc:off /t incremental /l "DailyBackup" /e

rem if errorlevel 4 goto errorlevel4
rem if errorlevel 3 goto abortlevel3
rem if errorlevel 2 goto conflictlevel2
rem if errorlevel 1 goto no_fileslevel1
rem if errorlevel 0 goto successlevel0

rem :errorlevel4
rem echo Backup stopped the process due to an error
rem goto exit
rem :abortlevel3
rem echo You just pressed CTRL+C to stop the backup
rem goto exit
rem :conflictlevel2
rem echo One or more files were not backed up due to a sharing conflict
rem goto exit
rem :no_fileslevel1
rem echo Sorry, but there were no files to backup
rem goto exit
rem :successlevel0
rem echo The backup was successful
rem goto exit
rem :exit

Hi! Tim Holman,
Thanks for your comment, I have tried to search for the log file which it my backup bat file saved in c:\bkp.bat, but it is not there, maybe my backup is not successful so it not create a lod file is it? shouldn't be right?
for the backup time shoudn't be so fast, because I am using blank tape with doing the 35GB database backup.

:::::::::::::::::::::::::::::::::::::::::::::::::::
Ntbackup backup T:\ /d "Daily Backup" /hc:off /t incremental /l "DailyBackup" /e

please anything wrong with the above command line.
0
 
Tim HolmanCommented:
The /e ensures only errors are logged to the log file.  If there aren't any errors, then you won't get any log file !

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now