Kbase P46267: Suggestions on how to run a broker as a service in a Windows environment.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/06/2009 |
|
Status: Verified
GOAL:
How to automate server startup and shutdown on Windows
GOAL:
How to use the AT command scheduler
GOAL:
How to run a broker as service
GOAL:
How to run _mprosrv.exe as service
FACT(s) (Environment):
Windows
Progress/OpenEdge Product Family
OpenEdge Category: Database
FIX:
Customers deploying the Progress server on Windows at times need to automate the database server startup and shutdown so that no user interaction is required and that when the user logs off, the _mprosrv process stays alive. Windows provides quite limited utilities for scheduling unattended processes. Almost all administration tools in Windows are graphical and require user interaction, there is no easy way to accomplish a totally automated server environment.
The best suggestion is to arrange the AT scheduler to run the command or the batch, so that when the user logs off from the system, the process is owned by the scheduler and will not terminate. This Solution entry describes how to achieve this by combining SRVANY with the AT command scheduler that is included with Windows.
To be able to use AT, the "Schedule" service needs to be running. To use AT or SRVANY, Administrator privileges are needed.
Step-by step instructions:
1) Create batch files for server startup and shutdown:
# startsrv.bat example:
SET DLC=C:\DLC
SET PATH=%DLC%\BIN;%PATH%
_mprosrv d:\work\dbname -S Servername
# stopsrv.bat example:
SET DLC=C:\DLC
SET PATH=%DLC%\BIN;%PATH%
_mprshut d:\work\dbname -by
2) To start the server at a certain time (say 11:00), issue the following command in command prompt:
AT 11:00 d:\work\startsrv.bat
The command should respond with a line similar to:
Added a new job with job ID = <num>
To see the entries in the scheduler queue, use ?AT? without any parameters (or quotation marks).
3) To shutdown the server at a certain time (say 11:15) :
A server that has been started with AT, needs proshut to be run via AT as well. If "proshut" is run from the command line, it will not shut down the database because the process is owned by the AT scheduler, not the user. It needs to be called in a batch process with the AT command. Issue the following command in command prompt:
AT 11:15 d:\ work\stopsrv.bat
4) To run a batch processes:
If the server has been started with AT, the batch process also needs to be started via AT. Create a batch file similar to the server startup/shutdown examples above to run the batch process.
It is also possible to combine SRVANY with AT. SRVANY is a utility that is bundled with Windows Resource Kit and freeware versions are also available. Refer to the Resource Kit documentation for more information about SRVANY.
Once the Progress database server has been created as a service with SRVANY, the database server can be set to start automatically at system startup without user interaction. It is also possible to set up the server with SRVANY in a way that proshut or batch processes can be run directly from command line.
1) Install the database startup as service. In this example SRVANY.EXE is installed as service name "SrvAny" and runs d:\work\startsrv.bat when it is started. Please note that when the SrvAny service is stopped, it does not actually stop the Progress server. To be able to use proshut or batch processes from the command prompt, the server needs to be set to log onto the system with an Administrative Account instead of the default system account. If the service is set to use a System Account, it will behave like a server started with AT.
2) Test that the database server can be started from Control Panel. The database should also be able to be shutdown the from the command line. If that fails, shut the server via AT or use:
proshut dbname -C disconnect <userNum>
3) To start the SrvAny service via AT, create a batch file that contains the following commands and pass that to the AT scheduler:
NET START SrvAny
NET STOP SrvAny
The first line starts the service and the database server, the second line stops the SrvAny service but does not actually bring the database server down. The server can .then be shut down either from the command line, via AT or over the network from a client.
The best way to determine which methodology that you?d like to employ is to try it yourself in a test environment and see what best suits your needs. These instructions and testing were done on Windows Workstation. Starting a database server with these tools has not been QA tested and is not officially supported by Progress Software.
For another example please refer to Solution P130259, "How to restart the Fathom replication server under the Local System Account".