Backup bat file

T

TRD

I am trying to use the built in program to run scheduled backups. I am
trying to use a bat file to make the backup run and backup directly to the
dds 4 tape drive. I have seen the page on smallbizserver.net on backing up
the server. But I can't create a backup file on the server as there is not
enough room so I would like to change the bat file to backup directly to the
dat drive. Has anyone done this? If so can I get a sample bat or point me
where I can get this to work.

TIA

TRD
 
P

Pegasus \(MVP\)

TRD said:
I am trying to use the built in program to run scheduled backups. I am
trying to use a bat file to make the backup run and backup directly to the
dds 4 tape drive. I have seen the page on smallbizserver.net on backing up
the server. But I can't create a backup file on the server as there is not
enough room so I would like to change the bat file to backup directly to the
dat drive. Has anyone done this? If so can I get a sample bat or point me
where I can get this to work.

TIA

TRD

What tool do you intend to use for your backup process? ntbackup.exe?
 
L

Lanwench [MVP - Exchange]

TRD said:
I am trying to use the built in program to run scheduled backups. I am
trying to use a bat file to make the backup run and backup directly
to the dds 4 tape drive. I have seen the page on smallbizserver.net
on backing up the server. But I can't create a backup file on the
server as there is not enough room so I would like to change the bat
file to backup directly to the dat drive. Has anyone done this? If so
can I get a sample bat or point me where I can get this to work.

TIA

TRD

Here's what I use...and as usual, MANY thanks to the kindly fellow I cribbed
it from. You'll need to make lots of changes to suit your environment - your
tape library, media type, etc.... Save your NTBackup job settings as a .bks
file and reference it in the batch file - it will also let you e-mail a copy
of the logs if you install BLAT (google it - freeware). Mind word wrap@

--------------------------------------------

title SERVERNAME Full Nightly Backup Job

rem ---------------------- REFRESH DRIVE -----------------

rem Run rsm view /tlibrary to find out the proper name...and
rem you'll need sleep.exe from the resource kit. This file presumes
rem a Dell PowerVault DLT drive....and SP4 on W2k to enable
rem the inventory command.


rsm.exe inventory/LF"Dell (TM) PowerVault (TM) 110T DLT1 Drive" /AFULL
sleep 30

rem ---------------------- VARIABLES ----------------------

rem clear variable contents
set srvname=
set notify=
set notifycc=
set bkdir=

rem ***set server name****

set srvname=SERVERNAME

rem ***set server name****


rem ***set working dir******
rem make sure you set this to what you want
set bkdir=e:\backups

rem ***set working dir******

rem ***set person/group to notify***
set [email protected]
rem set [email protected]
rem ***set person/group to notify***

rem clear variable contents
set tm=
set rtm=
set dt=
set label=

if "%srvname%"=="" goto END
if "%bkdir%"=="" goto END
if "%notify%"=="" goto END
goto BEGIN

:BEGIN
rem **** set date, time, and label variables
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
for /f "Tokens=1" %%i in ('time /t') do set rtm=%%i
set tm=%tm::=-%
set label=full-%srvname%-%dt%%tm%m



rem ---------------------- JOB EXECUTION SECTION ----------------------

rem The backup job here is obviously called backup.bks - it's a job set up
rem in NTBackup that also includes the Exchange stores, etc....
rem You'll need to set the media type to DLT or DDS or whatever it is

C:\WINNT\system32\NTBACKUP.EXE backup "@%bkdir%\backup.bks" /n "%label%" /d
"full" /v:yes /r:no /rs:no /hc:blush:n /m normal /j "full" /l:s /p "DLT" /um

rem ---------------------- EJECT TAPE AFTER BACKUP ----------------------

rsm eject /PF"%label% - 1" /astart

rem ---------------------- LOG AND NOTIFICATION
SECTION ----------------------

rem **** Here, the logs are copied out of the default "userprofile"
rem **** folder, and placed in the working dir set above. Afterwards, the
most recently modified log file
rem **** will be email via blat.exe to those listed in the "notify" section
above.

if not exist %bkdir%\logs mkdir %bkdir%\logs
copy "%userprofile%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data\backup*.log" %bkdir%\logs
for /f "eol=g" %%i in ('dir %bkdir%\logs\*.log /od /b') do echo %%i >
%bkdir%\_logtemp
for /f %%i in (%bkdir%\_logtemp) do set logfile=%%i

echo Full backup completed on %dt% at %rtm%m > %bkdir%\_notify.txt
echo You may check the attached log to verify that it was successful. >>
%bkdir%\_notify.txt
echo Please report any errors to the administrator >> %bkdir%\_notify.txt
echo. >> %bkdir%\_notify.txt
echo ****************************************************************** >>
%bkdir%\_notify.txt
echo Remove the tape and label it with the appropriate name. >>
%bkdir%\_notify.txt
echo Insert the following night's tape. >> %bkdir%\_notify.txt
echo Please note: If tape is not changed, the BACKUP WILL NOT occur, >>
%bkdir%\_notify.txt
echo and there is a possibility that previous data will be overwritten. >>
%bkdir%\_notify.txt
echo ****************************************************************** >>
%bkdir%\_notify.txt
echo. >> %bkdir%\_notify.txt
echo -Administrator >> %bkdir%\_notify.txt

rem Make sure you have BLAT installed!

blat %bkdir%\_notify.txt -mime -t (e-mail address removed) -cc
"%notifycc%" -subject "Backup Logs for %srvname%" -f
(e-mail address removed) -attach %bkdir%\logs\%logfile%

del %bkdir%\_notify.txt
del %bkdir%\_logtemp

goto END

:END
cls
exit
 
T

TRD

Can I download Sleep.exe from somewhere. I don't have the 2000 resource kit.




"Lanwench [MVP - Exchange]"
 
T

TRD

Nevermind found it. Thanks everyone.

TRD said:
Can I download Sleep.exe from somewhere. I don't have the 2000 resource kit.




"Lanwench [MVP - Exchange]"
Here's what I use...and as usual, MANY thanks to the kindly fellow I cribbed
it from. You'll need to make lots of changes to suit your environment - your
tape library, media type, etc.... Save your NTBackup job settings as a .bks
file and reference it in the batch file - it will also let you e-mail a copy
of the logs if you install BLAT (google it - freeware). Mind word wrap@

--------------------------------------------

title SERVERNAME Full Nightly Backup Job

rem ---------------------- REFRESH DRIVE -----------------

rem Run rsm view /tlibrary to find out the proper name...and
rem you'll need sleep.exe from the resource kit. This file presumes
rem a Dell PowerVault DLT drive....and SP4 on W2k to enable
rem the inventory command.


rsm.exe inventory/LF"Dell (TM) PowerVault (TM) 110T DLT1 Drive" /AFULL
sleep 30

rem ---------------------- VARIABLES ----------------------

rem clear variable contents
set srvname=
set notify=
set notifycc=
set bkdir=

rem ***set server name****

set srvname=SERVERNAME

rem ***set server name****


rem ***set working dir******
rem make sure you set this to what you want
set bkdir=e:\backups

rem ***set working dir******

rem ***set person/group to notify***
set [email protected]
rem set [email protected]
rem ***set person/group to notify***

rem clear variable contents
set tm=
set rtm=
set dt=
set label=

if "%srvname%"=="" goto END
if "%bkdir%"=="" goto END
if "%notify%"=="" goto END
goto BEGIN

:BEGIN
rem **** set date, time, and label variables
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
for /f "Tokens=1" %%i in ('time /t') do set rtm=%%i
set tm=%tm::=-%
set label=full-%srvname%-%dt%%tm%m



rem ---------------------- JOB EXECUTION SECTION ----------------------

rem The backup job here is obviously called backup.bks - it's a job set up
rem in NTBackup that also includes the Exchange stores, etc....
rem You'll need to set the media type to DLT or DDS or whatever it is

C:\WINNT\system32\NTBACKUP.EXE backup "@%bkdir%\backup.bks" /n "%label%" /d
"full" /v:yes /r:no /rs:no /hc:blush:n /m normal /j "full" /l:s /p "DLT" /um

rem ---------------------- EJECT TAPE AFTER BACKUP ----------------------

rsm eject /PF"%label% - 1" /astart

rem ---------------------- LOG AND NOTIFICATION
SECTION ----------------------

rem **** Here, the logs are copied out of the default "userprofile"
rem **** folder, and placed in the working dir set above. Afterwards, the
most recently modified log file
rem **** will be email via blat.exe to those listed in the "notify" section
above.

if not exist %bkdir%\logs mkdir %bkdir%\logs
copy "%userprofile%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data\backup*.log" %bkdir%\logs
for /f "eol=g" %%i in ('dir %bkdir%\logs\*.log /od /b') do echo %%i >
%bkdir%\_logtemp
for /f %%i in (%bkdir%\_logtemp) do set logfile=%%i

echo Full backup completed on %dt% at %rtm%m > %bkdir%\_notify.txt
echo You may check the attached log to verify that it was successful. >>
%bkdir%\_notify.txt
echo Please report any errors to the administrator >> %bkdir%\_notify.txt
echo. >> %bkdir%\_notify.txt
echo ******************************************************************

%bkdir%\_notify.txt
echo Remove the tape and label it with the appropriate name. >>
%bkdir%\_notify.txt
echo Insert the following night's tape. >> %bkdir%\_notify.txt
echo Please note: If tape is not changed, the BACKUP WILL NOT occur, >>
%bkdir%\_notify.txt
echo and there is a possibility that previous data will be overwritten.

%bkdir%\_notify.txt
echo ******************************************************************

%bkdir%\_notify.txt
echo. >> %bkdir%\_notify.txt
echo -Administrator >> %bkdir%\_notify.txt

rem Make sure you have BLAT installed!

blat %bkdir%\_notify.txt -mime -t (e-mail address removed) -cc
"%notifycc%" -subject "Backup Logs for %srvname%" -f
(e-mail address removed) -attach %bkdir%\logs\%logfile%

del %bkdir%\_notify.txt
del %bkdir%\_logtemp

goto END

:END
cls
exit
 
L

Lanwench [MVP - Exchange]

Glad to help.
Nevermind found it. Thanks everyone.

TRD said:
Can I download Sleep.exe from somewhere. I don't have the 2000
resource kit.




"Lanwench [MVP - Exchange]"
TRD wrote:
I am trying to use the built in program to run scheduled backups.
I am trying to use a bat file to make the backup run and backup
directly to the dds 4 tape drive. I have seen the page on
smallbizserver.net on backing up the server. But I can't create a
backup file on the server as there is not enough room so I would
like to change the bat file to backup directly to the dat drive.
Has anyone done this? If so can I get a sample bat or point me
where I can get this to work.

TIA

TRD

Here's what I use...and as usual, MANY thanks to the kindly fellow
I cribbed it from. You'll need to make lots of changes to suit your
environment - your tape library, media type, etc.... Save your
NTBackup job settings as a .bks file and reference it in the batch
file - it will also let you e-mail a copy of the logs if you
install BLAT (google it - freeware). Mind word wrap@

--------------------------------------------

title SERVERNAME Full Nightly Backup Job

rem ---------------------- REFRESH DRIVE -----------------

rem Run rsm view /tlibrary to find out the proper name...and
rem you'll need sleep.exe from the resource kit. This file presumes
rem a Dell PowerVault DLT drive....and SP4 on W2k to enable
rem the inventory command.


rsm.exe inventory/LF"Dell (TM) PowerVault (TM) 110T DLT1 Drive"
/AFULL sleep 30

rem ---------------------- VARIABLES ----------------------

rem clear variable contents
set srvname=
set notify=
set notifycc=
set bkdir=

rem ***set server name****

set srvname=SERVERNAME

rem ***set server name****


rem ***set working dir******
rem make sure you set this to what you want
set bkdir=e:\backups

rem ***set working dir******

rem ***set person/group to notify***
set [email protected]
rem set [email protected]
rem ***set person/group to notify***

rem clear variable contents
set tm=
set rtm=
set dt=
set label=

if "%srvname%"=="" goto END
if "%bkdir%"=="" goto END
if "%notify%"=="" goto END
goto BEGIN

BEGIN
rem **** set date, time, and label variables
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 for /f "Tokens=1" %%i in ('time /t') do set rtm=%%i
set tm=%tm::=-%
set label=full-%srvname%-%dt%%tm%m



rem ---------------------- JOB EXECUTION SECTION
----------------------

rem The backup job here is obviously called backup.bks - it's a job
set up rem in NTBackup that also includes the Exchange stores,
etc.... rem You'll need to set the media type to DLT or DDS or
whatever it is

C:\WINNT\system32\NTBACKUP.EXE backup "@%bkdir%\backup.bks" /n
"%label%" /d "full" /v:yes /r:no /rs:no /hc:blush:n /m normal /j "full"
/l:s /p "DLT" /um

rem ---------------------- EJECT TAPE AFTER BACKUP ----------------------

rsm eject /PF"%label% - 1" /astart

rem ---------------------- LOG AND NOTIFICATION
SECTION ----------------------

rem **** Here, the logs are copied out of the default "userprofile"
rem **** folder, and placed in the working dir set above.
Afterwards, the most recently modified log file
rem **** will be email via blat.exe to those listed in the "notify"
section above.

if not exist %bkdir%\logs mkdir %bkdir%\logs
copy "%userprofile%\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data\backup*.log" %bkdir%\logs
for /f "eol=g" %%i in ('dir %bkdir%\logs\*.log /od /b') do echo %%i
%bkdir%\_logtemp
for /f %%i in (%bkdir%\_logtemp) do set logfile=%%i

echo Full backup completed on %dt% at %rtm%m > %bkdir%\_notify.txt
echo You may check the attached log to verify that it was
successful. >> %bkdir%\_notify.txt
echo Please report any errors to the administrator >>
%bkdir%\_notify.txt echo. >> %bkdir%\_notify.txt
echo
******************************************************************

%bkdir%\_notify.txt
echo Remove the tape and label it with the appropriate name. >>
%bkdir%\_notify.txt
echo Insert the following night's tape. >> %bkdir%\_notify.txt
echo Please note: If tape is not changed, the BACKUP WILL NOT
occur, >> %bkdir%\_notify.txt
echo and there is a possibility that previous data will be
overwritten.

%bkdir%\_notify.txt
echo
******************************************************************

%bkdir%\_notify.txt
echo. >> %bkdir%\_notify.txt
echo -Administrator >> %bkdir%\_notify.txt

rem Make sure you have BLAT installed!

blat %bkdir%\_notify.txt -mime -t (e-mail address removed) -cc
"%notifycc%" -subject "Backup Logs for %srvname%" -f
(e-mail address removed) -attach %bkdir%\logs\%logfile%

del %bkdir%\_notify.txt
del %bkdir%\_logtemp

goto END

END
cls
exit
 

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