Debian and Ubuntu use systemd for some time for service management, go still uses initd scripts which are not visible for systemctl and service tool on these systems (or at least on Ubuntu Xenial)
17.10.0-5380Ubuntu 17.04
systemctl start go-serverservice go-server startCommands 3 and 4 should start go-server service
Commands fails due to absence of systemd unit(service) file
root@ip-10-0-252-131:~# systemctl start go-server
Failed to start go-server.service: Unit go-server.service not found.
root@ip-10-0-252-131:~# service go-server start
Failed to start go-server.service: Unit go-server.service not found.
root@ip-10-0-252-131:~#
Write systemd unit file(type forking) which use current initd script commands and look on pid file and bundle it in go-server package
I've got a simple systemd unit file which works for me with the zip installation in case it helps:
https://github.com/bmaupin/junkpile/blob/master/systemd-services/go-server.service
At the very least the home folder for the binaries will need to be adjusted for the .deb installation.
I've updated the unit file posted here above by bmaupin (thanks for the initial version) with the following:
I tested all standard commands (start/stop/restart) and they work. Hope this helps someone else :).
https://github.com/VincenzoDo/go-server-systemd/blob/master/go-server.service
@VincenzoDo Out of curiosity, do you think the stop command is necessary? If all you're doing is killing the process, systemd should be able to handle that itself, right?
@bmaupin If I remember correctly I tested it without the stop command and it wouldn't stop the process automatically, that's why I added it. Also, I think that's due to the fact that when the process starts it actually starts a java process which isn't fully/correctly tracked by systemd.
I've recently installed GoCD on Debian 9 using the provided .deb package.
After installation, I had to run systemctl daemon-reload for systemd to detect the new initd script shipped with GoCD.
After running this command, the unit file generated by systemd became available. Then I was able to run commands like systemctl start go-server.
A user might not know that reloading the systemd daemon is required. This should have happened as part of the installation of the .deb package itself.
Closing. GoCD 19.7.0 and newer support systemd.
Most helpful comment
I've recently installed GoCD on Debian 9 using the provided .deb package.
After installation, I had to run
systemctl daemon-reloadfor systemd to detect the new initd script shipped with GoCD.After running this command, the unit file generated by systemd became available. Then I was able to run commands like
systemctl start go-server.A user might not know that reloading the systemd daemon is required. This should have happened as part of the installation of the .deb package itself.