Tomasz Maczukin 3b7119afcd Fix interaction with systemd (#274)
The library is using inconsistent names when calling `systemctl`
commands.

Let's say that the service is named `name`. The unit file will be
then named `name.service` - this is the popular pattern used also by
this library.

While for most common commands like `systemctl start` there is no
difference whether `name` or `name.service` will be used as the service
identifier, the `list-unit-files` command expects explicitly the unit
file name.

Currently just the name - without the `.service` suffix - is being used,
which causes the command to return no output, not match the name of the
service and finally respond the status of installed but inactive service
as `StatusUnknown` with `ErrNotInstalled` error. While `StatusStopped`
without any error is expected.

Considering `systemctl` behavior it's just easier to:

- have one method that constructs the `name.service` name,
- use it for all `systemctl` commands calls.

And this is the change that this commit is adding.
2021-06-10 06:40:54 -05:00
2015-01-18 17:48:14 -08:00
2020-11-16 08:44:20 -06:00
2015-09-01 09:34:29 -07:00
2020-11-17 11:30:05 -06:00
2015-01-13 09:41:14 -08:00
2016-02-29 19:27:48 -05:00
2020-11-17 11:30:05 -06:00
2020-11-17 11:30:05 -06:00
2020-06-07 11:28:44 -07:00
2020-11-17 11:30:05 -06:00
2020-06-07 11:28:44 -07:00
2018-08-20 11:44:20 -07:00

service GoDoc

service will install / un-install, start / stop, and run a program as a service (daemon). Currently supports Windows XP+, Linux/(systemd | Upstart | SysV), and OSX/Launchd.

Windows controls services by setting up callbacks that is non-trivial. This is very different then other systems. This package provides the same API despite the substantial differences. It also can be used to detect how a program is called, from an interactive terminal or from a service manager.

BUGS

  • Dependencies field is not implemented for Linux systems and Launchd.
  • OS X when running as a UserService Interactive will not be accurate.
S
Description
Run go programs as a service on major platforms.
Readme 3.8 MiB
Languages
Go 98.4%
Makefile 1%
Shell 0.3%
Dockerfile 0.3%