A batch file for Lotus Notes Domino maintenance on Windows Server 2003
Discover a batch file you can use with Microsoft Task Scheduler to run maintenance on a Lotus Notes Domino system sitting on top of Windows Server 2003.
Use this batch (.BAT) file in accordance with the Microsoft Windows Task Scheduler to perform maintenance on, and then reboot your Windows 2003 servers that are running Lotus Notes Domino.
You must have the shutdown.exe executable command on the Windows 2003 server and be able to execute it from the script for this reboot to work.
A few additional things to keep in mind when using this batch file:
- The script will wait for 30 seconds before starting, so that it can be cancelled if needed.
- Upon using the .BAT file, the Domino service is intermittently stopped.
- Dates are set up so that log files can be renamed with date and time stamps.
REM Domino shutdown script @ECHO OFF REM ping nonexistent IP address and wait 30 seconds for a time out request ECHO Waiting 30 seconds before shutting down the Domino Server... ECHO Press "<Ctrl>C" to stop shutdown ECHO. PING 1.1.1.1 -n 1 -w 30000 >NUL REM Shut down the Domino Service net stop "Lotus Domino Server (LotusDominoData)" ECHO Domino shutdown complete ECHO. @echo off REM Shutdown the Domino SNMP AgentService REM Setup Todays date to be used as the file extension for renamed datbases for /f "tokens=1,2,3,4* delims=/ " %%i in ('date /t') do set TDDAY=%%i&set TDMM=%%j&set TDDD=%%k&set TDYY=%%l for /f "tokens=1,2* delims=: " %%i in ('time /t') do set TDHH=%%i&set TDMIN=%%j REM Rename the log file ECHO Renaming log file ...........Please Wait ECHO. rename C:LotusDominoDatalog.nsf log%TDYY%%TDMM%% TDDD%%TDHH%%TDMIN%%.old ECHO log file has been renamed ECHO. REM Rename the domlog file if it exists ECHO Renaming domlog file ...........Please Wait ECHO. If exist C:LotusDominoDatadomlog.nsf rename C:LotusDominoDatadomlog.nsf domlog %TDYY%%TDMM%%TDDD%%TDHH%%TDMIN%%.old ECHO domlog file has been renamed ECHO. REM Delete all ".log" files that are more than 60 days old ECHO Purging log files ...........Please Wait ECHO. REM This will delete all *.old files in the Domino Data directory older than 60 days. To test it first, use this line: REM Forfiles -p C:LotusDominoData -s -m *.old -d -60 -c "cmd /c Echo 0x22@Path" REM This will delete all *.old files in the Domino Data directory older than 60 days. Forfiles -p C:LotusDominoData -s -m *.old -d -60 -c "cmd /c del @path" Forfiles -p C:LotusDominoDataIBM_ TECHNICAL_SUPPORT -s -m *.dmp -d -60 -c "cmd /c del @path" Forfiles -p C:LotusDominoDataIBM_TECHNICAL_ SUPPORT -s -m *.log -d -60 -c "cmd /c del @path" Forfiles -p C:LotusDominoDataIBM_TECHNICAL_ SUPPORT -s -m *.txt -d -60 -c "cmd /c del @path" Forfiles -p C:LotusDominoDataIBM_TECHNICAL_ SUPPORT -s -m *.zip -d -60 -c "cmd /c del @path" ECHO Old log files have been removed ECHO. REM names.nsf maintenance ECHO Performing maintenance on names.nsf ...........Please Wait ECHO. REM C:LotusDominonfixup names.nsf C:LotusDominonupdall names.nsf C:LotusDominoncompact names.nsf ECHO names maintenance complete ECHO. REM Perform Domino database maintenance on entire mail directory REM ECHO Performing maintenance on mail directory ...........Please Wait REM ECHO. REM C:LotusDominonfixup C:LotusDominoDatamail REM ECHO. REM ECHO. REM C:LotusDominonupdall -R C:LotusDominoDatamail REM ECHO. REM ECHO. REM C:LotusDominoncompact C:LotusDominoDatamail REM ECHO. REM ECHO maintenance complete REM ECHO. REM mailbox.box maintenance ECHO Performing maintenance on mailboxes ...........Please Wait ECHO. If Exist C:LotusDominoDatamail.box C:LotusDominonfixup mail.box If Exist C:LotusDominoDatamail1.box C:LotusDominonfixup mail1.box If Exist C:LotusDominoDatamail2.box C:LotusDominonfixup mail2.box If Exist C:LotusDominoDatamail3.box C:LotusDominonfixup mail3.box If Exist C:LotusDominoDatamail4.box C:LotusDominonfixup mail4.box If Exist C:LotusDominoDatamail.box C:LotusDominonupdall mail.box If Exist C:LotusDominoDatamail1.box C:LotusDominonupdall mail1.box If Exist C:LotusDominoDatamail2.box C:LotusDominonupdall mail2.box If Exist C:LotusDominoDatamail3.box C:LotusDominonupdall mail3.box If Exist C:LotusDominoDatamail4.box C:LotusDominonupdall mail4.box If Exist C:LotusDominoDatamail.box C:LotusDominoncompact -c mail.box If Exist C:LotusDominoDatamail1.box C:LotusDominoncompact mail1.box If Exist C:LotusDominoDatamail2.box C:LotusDominoncompact mail2.box If Exist C:LotusDominoDatamail3.box C:LotusDominoncompact mail3.box If Exist C:LotusDominoDatamail4.box C:LotusDominoncompact mail4.box ECHO MailBox maintenance complete ECHO. echo Run shutdown command. SHUTDOWN /L /R /T:0
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Jerry Ober. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.