- winsvc package mit Build-Tag-basierter plattformspezifischer Implementierung: - service_windows.go: svc.Handler + Install/Uninstall/Start/Stop via windows/svc/mgr - service_stub.go: Stub-Implementierungen für nicht-Windows Builds - main.go refaktoriert: - os.Executable() für absoluten Config-Pfad (Service-Modus: CWD = C:\Windows\System32) - Kommandozeilen-Args: install / uninstall / start / stop - winsvc.IsWindowsService() Erkennung → Service-Modus oder Konsolen-Modus - Agent-Loop als makeRunFn() extrahiert (wiederverwendbar für beide Modi) - install-service.ps1: Convenience-Skript zum Bauen, Installieren und Starten Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
803 B
Go
34 lines
803 B
Go
//go:build !windows
|
|
|
|
package winsvc
|
|
|
|
import "errors"
|
|
|
|
const (
|
|
ServiceName = "NexusRMMAgent"
|
|
ServiceDisplayName = "NexusRMM Agent"
|
|
ServiceDescription = "NexusRMM Remote Monitoring and Management Agent"
|
|
)
|
|
|
|
func IsWindowsService() (bool, error) { return false, nil }
|
|
|
|
func Run(_ func(stop <-chan struct{})) error {
|
|
return errors.New("Windows Service wird nur unter Windows unterstützt")
|
|
}
|
|
|
|
func Install(_ string) error {
|
|
return errors.New("Windows Service wird nur unter Windows unterstützt")
|
|
}
|
|
|
|
func Uninstall() error {
|
|
return errors.New("Windows Service wird nur unter Windows unterstützt")
|
|
}
|
|
|
|
func Start() error {
|
|
return errors.New("Windows Service wird nur unter Windows unterstützt")
|
|
}
|
|
|
|
func Stop() error {
|
|
return errors.New("Windows Service wird nur unter Windows unterstützt")
|
|
}
|