| Unstable applications may cause an unstable environment. Rebooting the system helps the operating system from becoming unstable. This allows the system to recover from applications leaking memory and other system resources. I also like to take the opportunity to do some proactive maintenance to the server. i.e., clean hung print jobs out of the spooler folder and if you are using Microsoft Access as the IMA data store can take this time to backup the data store and copy it to a remote file store that is backed up on a daily basis. Although as much as I like rebooting servers to flush memory and clean up errant processes I cant argue with those who say it is an inconvenience to the end-user when they are in the middle of something and are prompted to logoff in 5 minutes. With this in mind Don Morse came up with the srvchk.exe utility to actively scan for logged on users. If there are no logged in users, or you have disconnected users the program will generate a file you specify. You can use the shutdown script to check for the existence of this file and if it exists start the shutdown process. The command line options for the program are as follows. srvchk {server name} {Retries} The shutdown.cmd file shows how this command would be used to start a shutdown of the system. If the output flag file exists it starts a shutdown, if the file does not exist it loops back and waits for 60 seconds using the sleep.exe command and then check the server status using the srvchk.exe file. The process will repeat until there are no active users on the MetaFrame XP server or the number of retries has counted down to zero. How to Setup and Configure Automatic Reboots of MetaFrame XP Servers The following procedures describe how to create and schedule the recycling of your MetaFrame XP Servers. 1. Create a folder off the root of C: called REBOOT. 2. Open Notepad and enter the following script and save it as shutdown.cmd | if exist time.flg del time.flg if exist metaframe-demo.flg del metaframe-demo.flg change logon /disable date /t >>log.txt echo Starting shutdown script >>log.txt goto firstrun :check sleep 60 :firstrun srvchk metaframe-demo 10 sleep 10 if exist metaframe-demo.flg goto reboot if not exist time.flg goto timeout goto check :reboot echo Printers - Shutting down the print spooler >>log.txt del metaframe-demo.flg net stop spooler sleep.exe 120 echo Printers - Deleting print queues >>log.txt del c:\WINNT\System32\spool\PRINTERS\*.* /q echo Shutdown - Starting Shutdown >>log.txt tsshutdn.exe /REBOOT goto exit :timeout echo Aborted - Shutdown script timed out.>>log.txt change logon /enable :exit echo exited >>log.txt | The SHUTDOWN.CMD script will do the following: Disable any Disable any additional users from logging on Stops for 5 seconds Stops the Spooler server Waits 30 seconds for the spooler service to stop Deletes any print jobs in the print spooler directory NOTE: You might need to change this file path in case you changed the default spool directory as recommended in the tuning section of this document. If you are using Microsoft Access as the IMA data store then you will want to take this opportunity to backup the database and copy it to a remote file server for disaster recovery. o Stops the IMA service o Waits 30 seconds for the data store to stop. You might need to tweak this time to make sure you give enough time for the service to be stopped. o Copy the IMA database (mf20.bak) to a remote file server. Schedule nightly server reboots. You will want to stagger servers reboots in at least 15 minute intervals. Note: TSSHUTDN.EXE is supplied natively with Microsoft Windows 2000 and Windows Server 20003 Servers. The above script, srvchk.exe and sleep.exe can be found in the Utilities\ Policies and Scripts folder found in the uncompressed files of MIAB3.0.zip (www.dabcc.com/miab) Important! It is important to stagger the reboot time on each MetaFrame XP Server. I recommend at least 10 minute intervals and to recycle the MetaFrame XP Data Collector server first. The following defines how to schedule the reboot script to execute at a specific time on Microsoft Windows 2000 Server. 1. Click on the Start button Settings Control Panel double click on the Scheduled Tasks icon double click on the Add Scheduled Task icon.  2. Click Next  3. Click Browse  4. Browse to the reboot folder you created in step 1 and select shutdown.cmd and click Open  5. Enter a name for the task and select how often you would like the task to run and click Next.  6. Select the time and day you want the server to be rebooted and click Next. Note: As stated above you will want to stagger server reboots. This is very important!  7. Enter a username and password that has access to reboot the MetaFrame XP Server and click Next.  8. Click Finish.  You have now successfully scheduled the server to automatically reboot. The following defines how to schedule the reboot script to execute at a specific time on Microsoft Windows b Server. 1. Click on the Start button click Control Panel click Scheduled Tasks icon click Add Scheduled Task  2. Click Next  3. Click Browse  4. Browse to the reboot folder you created in step 1 and select shutdown.cmd and click Open  5. Enter a name for the task and select how often you would like the task to run and click Next.  6. Select the time and day you want the server to be rebooted and click Next. Note: As stated above you will want to stagger server reboots. This is very important!  7. Enter a username and password that has access to reboot the MetaFrame XP Server and click Next.  8. Click Finish.  You have now successfully scheduled the server to automatically reboot. |