09.12.2007

SnTT: Starting Batch Files with Program Documents

>>Author:  Thomas Bahn
>>Ort:     Raisdorf
        
URL: https://www.assono.de/blog/d6plinks/Starting-Batch-Files-with-Program-Documents

Kategorien: Show-n-Tell Thursday, Administration, Lotus Domino, ADMIN2007 Europe

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%"

Kommentare

#1 A small update for the sample batch file/eine kleine Verbesserung für die Beispiel-Batch-Datei:
{ Link }
Gravatar Image

Senden Sie einen Kommentar

Kommentare

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Tags

Deutsche RSS-Feeds (German)

Custom Button Custom Button

English RSS feeds

Custom Button Custom Button