Go is a programming language developed by Google that can be used to build web applications as well as standalone applications. A Go script can be run as a Windows Service using FireDaemon Pro, which allows you to have the script start automatically at boot prior to login, start multiple instances of the script and more. This HOWTO will show you how to set it up. You can also use FireDaemon Fusion to manage FireDaemon and other Windows services via a web browser.
Go Setup Under FireDaemon Pro
Download the latest version of Go from the official website.
Install Go. For the purposes of this installation we will use C:\Go.
Run your Go script from the command line with go run scriptname.go to ensure it works before setting up FireDaemon Pro. If your script doesn't work here, then it won't work as a service with FireDaemon Pro.
Download and install FireDaemon Pro into the directory of your choice, typically C:\Program Files\FireDaemon.
Next start the FireDaemon GUI from the desktop shortcut. Click on the "Create a new service definition" button in the toolbar (or type Ctrl+N) and enter the information into the fields as you see below. Adjust the paths to suit your installation. Note the required parameters.
- Executable: The path to your go.exe file. The default path is C:\Go\bin\go.exe
- Working Directory: The directory that contains your go.exe file. The default path is C:\Go\bin\go.exe
- Parameters: run [path to script]
Now click on the Settings tab. If you DON'T want to see the Go running, uncheck the Interact with Desktop check box & select "Hidden" from the "Show Window" dropdown. You can optionally run your Go as the user you installed it as. You can also change the Process Priority to allocate more CPU time to the Go script or specify which CPU or core the script will run on (in the case of multi-processor, hyperthreaded or multi-core CPUs).
Now click on the Lifecycle tab. Uncheck Graceful Shutdown as it can slow the shutdown of the Go script. Make sure "Console Application" is checked.
Now click OK to finish setup and start your Go script!