Activate Systemd for Go executeables
Systemd is a magic service that keeps your Go site running by monitoring that the site is running. If needed, systemd restarts the service. You have to point to which Go executable that should be monitored. Each site has its own service and should be placed in
1. Create service
/etc/systemd/system/gowebdev.service
Each "site.service" should look something like this:
[Unit] Description=gowebdev [Service] Type=simple User=root Restart=always RestartSec=5s WorkingDirectory=/var/www/gowebdev ExecStart=/var/www/gowebdev/main [Install] WantedBy=multi-user.target
2. Reload Systemd
When the service is created, you must reload systemd.
systemctl daemon-reload
3. Start Systemd service
Once enabled, you can start, stop and restart this service
service go4webdev restart (replace with your own "service name")
To enable start at boot, you have to run this command
sudo systemctl enable go4webdev (replace with your own "service name")
You can also use Webmins built in System > Bootup and Shutdown