en · de

SnTT: Starting Batch Files with Program Documents

by Thomas,
assono GmbH, Standort Kiel,

showntell-w120.png At the THE VIEW ADMIN2007 Europe:

Susan Bulloch did a session named "Server Maintenance Toolkit" about how to keep your Domino servers running, how to automate the necessary maintenance task and how to prevent errors before they occur.

In the course of the session, one question occured: Can program documents start Windows batch files?

My definitiv answer is: "Yes, they can." But not directly.

The little trick is to call CMD,exe with the /c parameter followed by the complete file name and path of the batch file (.bat or .cmd file). If the file name or path contains space characters, include it in double quotes.

Example of a program document: A picture named M2

This way, you can even stop the Domino service, do something (like running some Domino tasks or copying some files), while the server is down, and restart the Domino service again.

Example batch file:

@ECHO OFF
REM variable parts; to be adapted for each installation
SET DOMINO_SERVICE=Lotus Domino Server (notesdomino6)
SET DOMINO_PROGS=C:\Programme\Domino6
SET DOMINO_DATA=D:\Notes\Domino6
SET BATCH_FILE_LOG=%DOMINO_DATA%\weekly-maintenance.log

REM log settings
ECHO Weekly maintenance started >>"%BATCH_FILE_LOG%"
date /t >>"%BATCH_FILE_LOG%"
time /t >>"%BATCH_FILE_LOG%"
ECHO DOMINO_SERVICE: %DOMINO_SERVICE% >>"%BATCH_FILE_LOG%"
ECHO DOMINO_PROGS: %DOMINO_PROGS% >>"%BATCH_FILE_LOG%"
ECHO DOMINO_DATA: %DOMINO_DATA% >>"%BATCH_FILE_LOG%"
ECHO. >>"%BATCH_FILE_LOG%"

ECHO Stopping Domino service >>"%BATCH_FILE_LOG%"
net stop "%DOMINO_SERVICE%" >>"%BATCH_FILE_LOG%"

ECHO Compacting system databases >>"%BATCH_FILE_LOG%"
"%DOMINO_PROGS%\ncompact" -c -i names.nsf >>"%BATCH_FILE_LOG%"
"%DOMINO_PROGS%\ncompact" -c -i admin4.nsf >>"%BATCH_FILE_LOG%"
"%DOMINO_PROGS%\ncompact" -c -i events4.nsf >>"%BATCH_FILE_LOG%"
REM Domino 7+ only
REM "%DOMINO_PROGS%\ncompact" -c -i ddm.nsf >>"%BATCH_FILE_LOG%"

ECHO Refreshing view in Domino Directory >>"%BATCH_FILE_LOG%"
"%DOMINO_PROGS%\nupdall" -R names.nsf >>"%BATCH_FILE_LOG%"

ECHO Save log database (4 generations) >>"%BATCH_FILE_LOG%"
DEL "%DOMINO_DATA%\log.nsf.4" >>"%BATCH_FILE_LOG%"
REN "%DOMINO_DATA%\log.nsf.3" "%DOMINO_DATA%\log.nsf.4" >>"%BATCH_FILE_LOG%"
REN "%DOMINO_DATA%\log.nsf.2" "%DOMINO_DATA%\log.nsf.3" >>"%BATCH_FILE_LOG%"
REN "%DOMINO_DATA%\log.nsf.1" "%DOMINO_DATA%\log.nsf.2" >>"%BATCH_FILE_LOG%"
REN "%DOMINO_DATA%\log.nsf" "%DOMINO_DATA%\log.nsf.1" >>"%BATCH_FILE_LOG%"

ECHO Restarting Domino service >>"%BATCH_FILE_LOG%"
net start "%DOMINO_SERVICE%" >>"%BATCH_FILE_LOG%"
ECHO. >>"%BATCH_FILE_LOG%"

ECHO Weekly maintenance completed >>"%BATCH_FILE_LOG%"
date /t >>"%BATCH_FILE_LOG%"
time /t >>"%BATCH_FILE_LOG%"
ECHO. >>"%BATCH_FILE_LOG%"

Event Technical article IBM Domino Administration

You have questions about this article? Contact us: blog@assono.de

Sie wollen eine individuelle Beratung oder einen Workshop? Read more

More interesting entries

Any questions? Contact us.

If you want to know more about our offers, you can contact us at any time. There are several ways to contact us for a non-binding first consultation.

assono GmbH

Location Kiel (headquarters)
assono GmbH
Lise-Meitner-Straße 1–7
24223 Schwentinental

Location Hamburg
assono GmbH
Bornkampsweg 58
22761 Hamburg

Phone numbers:
Human resources department: +49 4307 900 407
Marketing department: +49 4307 900 411

E-Mail adresses:
contact@assono.de
bewerbung@assono.de