Capabilities to manage a Windows service

In some instances it is needed to call the Java program GReportWriter in distributed mode to assist with reporting. Running the program decreases the execution time of the reporting process and the batch file named greportwriter.bat ensures always having an instance of the JVM running with GReportWriter.

GReportWriter is not comparable to a Linux® daemon or a Windows service since it must be managed interactively by the user. The following capabilities to install and manage a Windows Service are used to call the Java program GReportWriter internally.

Installation

The Windows service is handled by the batch file greportwriter.bat. The five following options are used to manage it.
>greportwriter --install-winService      // Install the Windows Service,
>greportwriter --install-winService 1234 // Install and use the port 1234,
>greportwriter --uninstall-winService    // Uninstall the Windows Service,
>greportwriter --start-winService        // Start the Windows Service,
>greportwriter --stop-winService         // Stop the Windows Service,
>greportwriter --monitor-winService      // Start the GUI application.

All these commands must be run in a terminal with administrator rights.

The --install-winService option installs the Windows service on the system and listens on port-4400. To use another port, specify the port after the option in the terminal. When the service is installed, it is accessed through the Windows Services list - service.msc.

From here, greportwriter.bat can start, stop or uninstall the service using the commands:
  • --start-winService
  • --stop-winService
  • --uninstall-winService

The Monitor Application

greportwriter.bat allows you to manage the Windows service as soon as it is installed with the --monitor-winService command. This allows modifying the startup type of the service. The command starts a GUI application that is accessible from the system tray.



This allows starting and stoping the service, permits configuring the logging location or modifying the JVM running GReportWriter configuration.

Logging capabilities

By default, the GReportWriter Windows Service outputs logs into files located under the C:\Windows\ServiceProfiles\LocalService :

  • commons-daemon.[date] - This file corresponds to the logs of the Windows Service itself. It contains information about the health of the service.
  • greportwriter-stderr.[date] - This file corresponds to the standard error of GReportWriter.
  • greportwriter-stdout.[date] - This file corresponds to the standard output of GReportWriter.

Change the location of the above logs through the GUI application from the system tray. The Logging tab allows management of logs.