F
FB
Guest
Win2003 SP2 STD 64-Bits, IBM xSeries 3650 and LTO-2 Ultrium Tape Drive
I´m trying to build a new Batch to do automated Backup.
All my previous Batches and Jobs were delete, so i colud do "from scratch"
(sometines NTBackup doensn´t work and a manual Backup always worked as an
alternate solution)
Now i wrote an entirely new routine changing from "Wizard Model" to my New
Batch .CMD file
Previously, the NTBackup Wizard was used to build a scheduled task with the
default parameters used on the Scheduled Task
I´m doing a simpe command line with the minimal switches:
c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO Ultrium"
(with or without /um)
The NTBackup app opens and closes with no event in Event Log and a Blank
..LOG file
If i try to use:
c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"
The Backup works fine
The BKS file have a valid structure (i´ve tried systemstate, a path with a
slash "/" in the end.. nothing works) and is in a valid place (i´ve tried on
several diff locations)
The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
command-line BLAT app and variables to extract day of the week and date in
DD-MM-YY format
@echo off
cls
echo.
echo.
echo Rotina de Backup CQI - Versao 1.3fb
echo.
echo.
echo Definindo variaveis de ambiente
echo.
echo.
echo Obtendo a data atual via DATE-TIME
for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
set DataAtualDMA=%dd%/%mm%/%yy%
for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
set SMTPSERVER=MYIPSMTPSERVER
set DESTDOMAIN=MyCompanyDOmain
set TARGET=%COMPUTERNAME%
set CXPOSTAL=MyE-MailAddress
set YESNO=no
set PARAMS=/r:no /rs:no /hcn /m normal
set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
set BKSFILE="@C:\Documents and Settings\svc-backup\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
echo.
cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data"
%NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
%DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um
echo.
echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
echo.
echo Obtendo o arquivo mais novo
setlocal ENABLEDELAYEDEXPANSION
set file=N
; rem ***************************
; rem *** set user=%UserProfile%
; rem ***************************
; rem *** if {%1} NEQ {} set user=%1
; rem *** set user=%user:"=%
; rem ***************************
set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data
cd /d %folder%
for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU "N"
set file=%%v
echo.
echo.
echo Enviando E-Mails com os Logs de Backup anexados
blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
%CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
endlocal
exit /b 0
I´m trying to build a new Batch to do automated Backup.
All my previous Batches and Jobs were delete, so i colud do "from scratch"
(sometines NTBackup doensn´t work and a manual Backup always worked as an
alternate solution)
Now i wrote an entirely new routine changing from "Wizard Model" to my New
Batch .CMD file
Previously, the NTBackup Wizard was used to build a scheduled task with the
default parameters used on the Scheduled Task
I´m doing a simpe command line with the minimal switches:
c:\windows\system32\ntbackup backup "@pathtobks" /j "test" /p "LTO Ultrium"
(with or without /um)
The NTBackup app opens and closes with no event in Event Log and a Blank
..LOG file
If i try to use:
c:\windows\system32\ntbackup backup systemstate /j "test" /p "LTO Ultrium"
The Backup works fine
The BKS file have a valid structure (i´ve tried systemstate, a path with a
slash "/" in the end.. nothing works) and is in a valid place (i´ve tried on
several diff locations)
The Entire batch .CMD follows, with 3 parts: NTBACKUP, Send Mail by
command-line BLAT app and variables to extract day of the week and date in
DD-MM-YY format
@echo off
cls
echo.
echo.
echo Rotina de Backup CQI - Versao 1.3fb
echo.
echo.
echo Definindo variaveis de ambiente
echo.
echo.
echo Obtendo a data atual via DATE-TIME
for /f "Tokens=2-4 Delims=/ " %%a in ('date /t') do set mm=%%a&set
dd=%%b&set yy=%%c&set DataAtualDMA=%dd%/%mm%/%yy%
set DataAtualDMA=%dd%/%mm%/%yy%
for /f "Tokens=1-4 Delims=/ " %%m in ('date /t') do set DIASEMANA=%%m
set SMTPSERVER=MYIPSMTPSERVER
set DESTDOMAIN=MyCompanyDOmain
set TARGET=%COMPUTERNAME%
set CXPOSTAL=MyE-MailAddress
set YESNO=no
set PARAMS=/r:no /rs:no /hcn /m normal
set NTBACKUPBIN=C:\WINDOWS\system32\ntbackup.exe
set BKSFILE="@C:\Documents and Settings\svc-backup\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BACKUP.BKS"
echo.
cd /d "C:\Documents and Settings\svc-backup\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data"
%NTBACKUPBIN% backup SystemState /n "Media %DIASEMANA%" /d "Backup
%DIASEMANA%" /j "Job %DIASEMANA%" /v:%YESNO% %PARAMS% /p "LTO Ultrium" /um
echo.
echo Rotina para enviar o ultimo arquivo de LOG via E-Mail
echo.
echo Obtendo o arquivo mais novo
setlocal ENABLEDELAYEDEXPANSION
set file=N
; rem ***************************
; rem *** set user=%UserProfile%
; rem ***************************
; rem *** if {%1} NEQ {} set user=%1
; rem *** set user=%user:"=%
; rem ***************************
set folder=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data
cd /d %folder%
for /f "Tokens=*" %%v in ('dir backup*.log /b /O-D') do if "!file!" EQU "N"
set file=%%v
echo.
echo.
echo Enviando E-Mails com os Logs de Backup anexados
blat !FILE! -server %SMTPSERVER% -f %COMPUTERNAME%@%DESTDOMAIN% -to
%CXPOSTAL% -subject %COMPUTERNAME%-LogBackup-%DataAtualDMA%-!FILE!
endlocal
exit /b 0