As described in Introduction to the SystemWeaver Monitor Service, SystemWeaver server applications can be run as a service in Windows.
- You have successfully tested running all involved server applications as normal applications, i.e., not as a service, using the same versions and setting files. For example, for the SystemWeaver server, you would test by running either the swTestServer or the swServer (this may be called swDBServer depending on your version of SystemWeaver). For the Notification server, you would test by running swTestNotificationServer or swNotificationServer (e.g., see Testing the Notification Server Configuration). If there are any problems with the configurations, they will be more difficult to analyze when the servers are run as services so it is best to resolve them upfront.
- The server applications executables and their configuration files are in the locations where they will be run. The paths to them will be entered in the service configuration.
- You must have administrator rights to the server machine.
- An installation of swServerMonitorService. The files can be found in the Server directory in your installation and include the following:
- swServerMonitorService_install.bat: Installs the SystemWeaver Monitor Service as a service on the server computer.
- swServerMonitorService_uninstall.bat: Uninstalls the SystemWeaver Monitor Service as a service on the server computer.
- swServerMonitorService.exe: Manages all SystemWeaver server applications on a server computer. It starts all the server applications automatically and can restart them when necessary.
- Configuration files for swServerMonitorService. They are:
- swServerMonitorService.props: Used for configuration of the logging. A sample .props file is normally supplied in the SystemWeaver installation package.
- swServerMonitorService.settings: Defines all the server applications and their input files that are run under the service. A sample .settings file is normally supplied in the SystemWeaver installation package. The file format is described below in Format of .settings File.
Configuring the Service Settings
This section will guide you through configuration of the swServerMonitorService.settings file. At this point, all server applications should have already been tested successfully on their own and each server's executable and configuration files (i.e., .ini and .props or .nlog) are in the locations where they will be run.
- Place the 5 monitor service files listed above in an installation folder on the server machine where SystemWeaver is running. The folder should preferably be on a local drive to minimize the dependency on other servers. An example is shown below.
- Open the swServerMonitorService.settings file in a text editor, such as NotePad. Example content of the file is shown below.
<SystemWeaverMonitor> <Server restart="true"> <exe>C:\work\SystemWeaver\bin\swDBServer.exe</exe> <ini>C:\work\SystemWeaver\bin\swServer.ini</ini> <props>C:\work\SystemWeaver\bin\swServer.props</props> </Server> <!--Server> <exe>C:\work\SystemWeaver\bin\swServer.exe</exe> <ini>C:\work\SystemWeaver\bin\swServer2.ini</ini> <props>C:\work\SystemWeaver\bin\swServer2.props</props> </Server--> <Server restart="true" startDelay="10000"> <exe>C:\Work\Restapi\SystemWeaver.RestApi.exe</exe> </Server> <Server restart="true" startDelay="10000"> <exe>C:\work\SystemWeaver\bin\swNotificationServer.exe</exe> <ini>C:\work\SystemWeaver\bin\swNotificationServer.ini</ini> <props>C:\work\SystemWeaver\bin\swNotificationServer.props</props> </Server> </SystemWeaverMonitor>
In the example shown above, there are 4 server entries, one of which is commented out. The 3 servers that are set to run will restart automatically. The swNotificationServer and the REST API has a delayed start of 10 seconds to allow the main server executable to start first.
- Configure each server that will be run by the service using the Server Settings described below.
- Once your settings are correct, click Save to save your changes.
A <Server> entry is needed for each server application to be executed on as a service.
The optional restart attribute controls automatic restart of the server application, in case it has been terminated for some reason. This option makes the installation more robust to unexpected failures. Possible values are 'true' or 'false'
The optional startDelay attribute controls if the server start will be delayed. You can enter a value in number of milliseconds. This is recommended for servers such as swNotificationServer or any other server application which should start just after the SystemWeaver main server executable is started. Example: startDelay="10000" (for 10 seconds).
The <exe> entry should include the path to and name of the server's executable file.
The <ini> entry should include the path to and name of the server's configuration file.
Logging Configuration File
Configuring the Service Log
- To configure logging for the swServerMonitorService.exe, open the swServerMonitorService.props file in a text editor.
- Then, follow the instructions under Configure the Logging in How to Configure and Start Logging. INFO-level logging is sufficient for the monitor service.
Installing the Monitor Service
Install a SystemWeaver server monitor by running the swServerMonitorService_install.bat in a Windows Explorer window.
- To do this, right-click on the file and Run as administrator.
This will open a command prompt window and confirm a successful installation.
- Click OK and hit any key to close the window.
Note: Some servers may require that the service is run by a local administrator.
To confirm installation, go to the Windows Start menu and type 'Services'.
Select Services. The Services window will display. Scroll down to find the SystemWeaver Monitor Service entry.
By default, Windows sets the Startup Type to Automatic (i.e., the service starts at system logon). You can change this if desired. Refer to Microsoft for the various Windows Services options.
Tip: If you do not see the entry, you may need to use the Action>Refresh menu option.
You can right-click on the entry and view Properties to confirm the location of the monitor service installation that is now added as a service.
For instructions on how to start and stop the Monitor Service, see Starting and Stopping the Monitor Service.