Subject: Best way to schedule a daily server restart
Hi, this is what you want if you really want to reboot your Domino server every day.
This shuts down Domino as gracefully as possible, which is probably what you want if you are having such problems that you want to recycle Domino every day. This also reboots the operating system: works on Windows NT/2000/2003
-
Save this as a batch file (example c:\batch\dominomaintenance.bat)
-
Ensure that you have the Windows Scheduler Service Running
-
At the CMD prompt, generate this command to add this to the scheduler. If you use the CMD prompt instead of the GUI interface for the Scheduler Service, it will generate the job under the SYSTEM account instead of the account you are logged in to Windows with, which is what you want.
-
You may need to download the timeout.exe command which is part of the Windows NT/2000/or 2003 Resource Kit. I believe it can be downloaded for free from the Microsoft website.
C:\at.exe 03:00 /interactive /every:M,T,W,T,F,SA,SU c:\batch\dommaintenance.bat
BEGIN CODE (to be saved in the batch file)
@REM drop users and cache - where D:\lotus\domino is your program directory
D:
cd \lotus\domino
NSERVER.EXE -c “drop all”
NSERVER.EXE -c “dbcache flush”
@REM Stop the Domino service
NET STOP “Lotus Domino Server (LotusDominoData)”
@REM PAUSE 5 MINUTES TO GIVE TIME FOR THE DOMINO TASKS TO SHUTDOWN PROPERLY
TIMEOUT 300
@REM run nsd kill to terminate any tasks that haven’t shut down
D:\lotus\domino\nsd.exe -kill
@REM The following line works on Windows NT/2000/2003
shutdown /r /f /t 0 /d P:4:1
@REM Switches for the shutdown.exe (NT/2000/2003)
@REM /r: Use this switch to restart the computer instead of fully shutting it down.
@REM /f: force applications to quit
@REM /t 0 - means wait 0 seconds to execute the command (default is 30 if no switch)
@REM /d[p:xx:yy] indicates that this is a planned shutdown and gives the reason codes
@REM /d p:4:1 indicates “Application: Maintenance (Planned)”
END CODE
If you only want to restart Domino, you can probably run this code in the batch file instead of the above.
BEGIN CODE
@REM drop users and cache - where D:\lotus\domino is your program directory
D:
cd \lotus\domino
NSERVER.EXE -c “drop all”
NSERVER.EXE -c “dbcache flush”
NSERVER.EXE -c “restart server”
END CODE
Please see my previous post here for full maintenance job.
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/9acfd776a202cf0d852573360030f83a?OpenDocument&Highlight=0,killingsworth
Also, see Bastian Wieczorek’s OpenNTF project here.
http://www.openntf.org/projects/pmt.nsf/0/9A7B998D7BC8F92586257117005505C6