Solved

NT Backup Command

Posted on 2001-09-14
4
588 Views
Last Modified: 2013-12-28
"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
Comment
Question by:geoffry
  • 2
4 Comments
 
LVL 4

Expert Comment

by:arminl
ID: 6482491
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
 
LVL 23

Accepted Solution

by:
Tim Holman earned 100 total points
ID: 6482692
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
 
LVL 2

Author Comment

by:geoffry
ID: 6482924
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
 
LVL 23

Expert Comment

by:Tim Holman
ID: 6482959
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

Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now