Add Linux systemd support and --install-service/--remove-service flags
The service package now has a Linux implementation alongside the Windows one: systemd unit install/remove (/etc/systemd/system), readiness notification (READY=1 via go-systemd) sent only after the listeners are bound, a 30s watchdog, and STOPPING on shutdown. Listeners are pre-bound so port conflicts fail fast and the readiness signal is truthful. The notify calls are no-ops without NOTIFY_SOCKET (containers, shells) and on non-Linux builds. --install-service/--remove-service work on both platforms; the 'service install|remove' subcommand remains as an alias.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
//go:build !windows
|
||||
//go:build !windows && !linux
|
||||
|
||||
// Package service provides the non-Windows stubs for the Windows service
|
||||
// integration. Run falls back to plain signal handling; install/remove
|
||||
// are unsupported.
|
||||
// Package service provides the stubs for platforms without service
|
||||
// integration (Windows uses the SCM, Linux uses systemd). Run falls back
|
||||
// to plain signal handling; install/remove are unsupported.
|
||||
package service
|
||||
|
||||
import (
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// Name matches the Windows service name.
|
||||
const Name = "gpu-turnstile"
|
||||
|
||||
var errUnsupported = errors.New("service management is only supported on Windows")
|
||||
var errUnsupported = errors.New("service management is only supported on Windows and Linux (systemd)")
|
||||
|
||||
// IsService is always false on non-Windows platforms.
|
||||
func IsService() bool { return false }
|
||||
|
||||
Reference in New Issue
Block a user