This article covers how to set up the TransSECS Devices deployment to run as a Service on Windows and on Linux (and Raspberry Pi)
The instructions for running the TransSECS Devices deployment as a Windows service is identical as running MIX as a service, but is somewhat simplified since the run.bat file is generated automatically when the deployment is generated.
The steps are as follows (see the article on running MIX as a service for more details)
1. Download the Service wrapper software as described here. Copy the WinSW.NET461.exe and sample-minimal.xml file to the TransSECS Devices project's deployment directory. For example, if you just built the GEMTool project, there is a GEMToolDeployment directory in your project where these files will be copied.
2. Rename the WinSW.NET461.exe file from the step above to a name for your service executable. For example, if your deployment is for GEMTool, you might rename this exe to GEMTool.exe. Also rename the sample-minimal.xml file to match the name given to the exe, so for this example, GEMTool.xml.
3. Edit the GEMTool.xml (or whatever you renamed your configuration file for this project) in a text editor such as Notepad++. Detailed instructions for MIX can be used as a guide.
As an example, the section for the <service> definition for running the GEMTool deployment which is in the Projects directory of the default TransSECS Devices installation directory would look like:
<service> <!-- ID of the service. It should be unique across the Windows system--> <id>GEMTool</id> <!-- Display name of the service --> <name>GEMTool SECS/GEM Service</name> <!-- Service description --> <description>GEMTool SECS/GEM built by TransSECS</description> <!-- Path to the executable, which should be started --> <executable>C:/Users/Public/ErgoTech/TransSECSDevices/Project/GEMTool/GEMToolDeployment/run.bat</executable> </service>
Note: the default minimal configuration uses a %BASE% variable which could be defined instead of entering the full path to the application to run.
4. Install the Service
To install the service, open a command shell where you have just edited the GEMTool.xml (in the GEMTool project deployment directory), and enter this command:
GEMTool install
5. Open the Windows services console. You will see a GEMTool service listed. By default it is set to “Automatic” which means it will start when the computer starts. You can start it by selecting “Start”. It will then change to status “Running”.
You can stop/start/restart the service from this services console, or you can enter commands in the Windows command shell to do these functions. In the command shell you can also uninstall the service and stop or start it.
To get the full list of options for the service type “GEMTool -h” into the Windows command shell.
Examples:
GEMTool uninstall
GEMTool stop
6. Logging
The service will log just as the deployment which is started from the “run.bat” would log, i.e., SECSMessages.log. There are two additional logs, GEMTool.err.log and GEMTool.out.log. These will contain runtime errors and information from stderr and stdout printouts from the application, if any.