?
Solved

NT Backup Command

Posted on 2001-09-14
4
Medium Priority
?
638 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

719 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