A TransSECS deployment is the folder TransSECS builds for a project. It holds <ProjectName>Runtime.jar, ErgoTechConfiguration.properties, log4j2.xml and run.bat. Double-clicking run.bat starts the deployment in a console window. It stops when that window is closed, Ctrl+C is pressed in it, or the user logs off.
There are two ways to have a deployment start without anyone double-clicking run.bat:
| Startup folder | Windows service | |
|---|---|---|
| Starts | when the user logs in | when Windows starts, before anyone logs in |
| Console window | visible, like a hand-started deployment | none; output goes to log files |
| If the deployment stops | it stays stopped | Windows can restart it |
| When the user logs off | the deployment stops | the deployment keeps running |
| Setting it up | drag one shortcut, no extra software | a Java copy, the WinSW wrapper and an .xml file; needs Administrator rights |
Use the Startup folder on a machine where someone is always logged in and you want to see the console. Use a Windows service on an unattended machine, or where the deployment must keep running through log-offs and restart after a failure.
Before either: start the deployment once by hand with run.bat, on this machine, and check that it connects and that the log shows Valid IOT System Runtime License detected. See Running TransSECS deployments on the bottom half of this page. Licence and configuration problems are much easier to see in a console window.
shell:startup and press Enter. This opens your own Startup folder. To start the deployment for every user who logs in, type shell:common startup instead. Adding to that folder needs Administrator rights.run.bat into the Startup folder with the right mouse button, and choose Create shortcuts here. Do not copy or move run.bat itself. It must run inside the deployment folder, because that is where it finds the runtime jar, the licence and the settings.Things to know:
A Windows service starts with Windows, runs without a console window or a logged-in user, and can be restarted automatically if it stops. TransSECS uses WinSW 2.12.0, a small open-source program that runs a command as a Windows service.
In outline:
jre folder from <TransSECS installation>\MIStudioSuite\jre into the deployment folder, so that <deployment>\jre\bin\java.exe exists. A service does not use your PATH, and a copy keeps the service working when TransSECS is upgraded or removed.WinSW-x64.exe into the deployment folder and rename it, for example to GEMHostService.exe..exe, create an .xml file with the same base name (GEMHostService.xml). It names the service, the Java command line taken from run.bat, the start mode, what to do on failure, and how the log files roll over.GEMHostService.exe install, then GEMHostService.exe start.GEMHostService.exe status should say Started. The console output is written to GEMHostService.out.log and GEMHostService.err.log in the deployment folder.
After that, the service can be started and stopped from the Services window (services.msc) like any other.
The full instructions, with an example .xml file to copy, what each setting does, how to change and remove the service, and what to check when it does not start, are on Running a TransSECS deployment as a Windows service.
Remove the Startup shortcut or the service before you delete a deployment folder or the TransSECS installation:
GEMHostService.exe stop, then GEMHostService.exe uninstall.
Otherwise Windows keeps trying to start a program that no longer exists. The uninstall-readme.txt file in the TransSECS installation folder (also opened by How to Uninstall in the ErgoTech Start menu folder) lists the other steps.