Why not go all way and wrap the whole enchalada in one batch file? Something
like:

net stop {Whatever}
ntbackup yada, yada, yada
net start {Whatever}
blat yada, yada, yada (sends email)

To see ntbackup's command line options, run "ntbackup /?" from a command
line.

The easiest way to set this up is to interactively run ntbackup and tell it
to schedule the backup for later. This will force you to save your
selections to a file, and will create an entry in the scheduler with most of
the ntbackup switches you will need. Just look at the properties of the job
it creates.

Some caveats on using ntbackup from batch files:
ntbackup has a bug (at least up to win2k sp2) where it sometimes forgets to
check the drive for a tape. There are a couple of fixes, but the easiest is
to run "rsm.exe" before ntbackup. Try searching the Microsoft KB for
ntbackup and rsm.

ntbackup's log files are somewhat difficult to find, and are unicode to
boot. If you plan on searching the log files, get the win32 port of gnu
recode

Here's something I use:

Change the "BNCHMARK DLT1 SCSI Sequential Device" to whatever the name of
your tape drive is. See Q267574.

This batch file needs grep, recode, and blat. Use your favorite search
engine. 

rem *****************************************************************
rem *
rem * Perform fullback to whatever tape is in the drive and email
rem * report
rem *
rem * Ken Cornetet - 06/10/2002
rem *
rem * Revision History
rem *
rem * When        Who            What
rem * ---------------------------------------------------------------
rem * 06/10/2002  Ken Cornetet   Original Issue
rem * 06/24/2002  Ken Cornetet   Added RSM command per Q267574
rem *
rem *****************************************************************

set [EMAIL PROTECTED]
set SMTP=ntserver1
set NAME=FULL BACKUP %DATE% %TIME%

rem this is where NTBackup writes it's (unicode - blech) logs
set LOGS=%USERPROFILE%\Local Settings\Application Data\Microsoft\Windows
NT\NTBackup\data

c:
cd \backup

rem Delete any extranious log files
del "%LOGS%\backup*.log"

rem ************************************************************
rem * Have removable storage management look at tape in drive 
rem * (See Q267574 for details)
rem ************************************************************

start /wait rsm refresh /lf"BNCHMARK DLT1 SCSI Sequential Device"
c:\bin\sleep 30

rem ************************************************************
rem * Do Backup
rem ************************************************************

start /wait ntbackup backup @c:\backup\everything.bks /M normal /J "%NAME%"
/P DLT /N "%NAME%" /l:s /HC:on /UM /D "%NAME%"

rem ************************************************************
rem * find newest (should be only) log file
rem ************************************************************

dir /s /b /o-d "%LOGS%\backup*.log" >c:\backup\backup.tmp
set /P FILE= <c:\backup\backup.tmp

rem ************************************************************
rem * Make ASCII version of log file
rem ************************************************************

c:\bin\recode -f unicode..us <"%FILE%" >log.txt

rem ************************************************************
rem * Append list of open files to the report
rem ************************************************************

echo **************** OPEN FILES ************************ >>log.txt
net file >>log.txt

rem ************************************************************
rem * Set subject for email
rem ************************************************************

set SUBJ=Backup ran OK
grep -v "Error: You do not have permission" > log1.txt
findstr /i error: log1.txt 
if not ERRORLEVEL 1 set SUBJ=Backup ran - FAILED

rem ************************************************************
rem * Send email
rem ************************************************************

c:\bin\blat log.txt -t %RECIPIENT% -subject "%SUBJ%" -server %SMTP% -f
%RECIPIENT%

rem ************************************************************
rem * Move log file to our directory
rem ************************************************************

move /Y "%FILE%" c:\backup 


 


-----Original Message-----
From: Salandra, Justin A. [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 11, 2002 1:20 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] OT: How to schedule a service to stop and
restar t?


Net start <service name>
Net stop <service name>

Each line goes in their own BAT file and you use task scheduler to run them
at designated times.

 -----Original Message-----
From:   Kevin Felker [mailto:[EMAIL PROTECTED]] 
Sent:   Friday, October 11, 2002 2:17 PM
To:     [EMAIL PROTECTED]
Subject:        RE: [ActiveDir] OT:  How to schedule a service to stop and
restart?

 That sounds easy, but what do I put in the batch file, someone earlier said
to use vbs scripts, do I create a vbs file and put the file name in the
batch file?
-----Original Message-----
From:   Craig Cerino [mailto:[EMAIL PROTECTED]] 
Sent:   Friday, October 11, 2002 12:40 PM
To:     [EMAIL PROTECTED]
Subject:        RE: [ActiveDir] OT: How to schedule a service to stop and
        restart?

Kevin-if you creat a small batch file (.bat)  to stop and one to
start the services in question -- - you can just schedule tasks through
scheduler to kick off those batch files. 1-2-6 yer done 
-----Original Message-----
From:   Kevin Felker [mailto:[EMAIL PROTECTED]] 
Sent:   Friday, October 11, 2002 12:47 PM
To:     [EMAIL PROTECTED]
Subject:        [ActiveDir] OT: How to schedule a service to stop and
restart?

All,
I'm trying to do a system backup of my server, but not all of it is backing
up since certain services are running (such as SQL SERVER).
If I have my backup scheduled for 3:00AM, I would like to stop the SQL
SERVER Service at 2:50AM, and restart it at 4:00AM.
What is the best way to do this?
Thanks
Kevin
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to