feat(cmd): add installall/uninstallall; fix startall/stopall and service lifecycle

- startall now uses systemctl start (not enable --now)
- stopall now uses systemctl stop (not disable --now)
- add installall command (bulk install with --dry-run support)
- add uninstallall command (bulk disable+remove in reverse order)
- fix docker ExecStart to use -a flag so the process stays attached
- prefix ExecStop with - so a stop-on-already-dead container does not fail the unit
This commit is contained in:
2026-07-05 15:12:18 +02:00
parent e6ef6e11d6
commit 029b9cee2e
9 changed files with 298 additions and 16 deletions
+3 -3
View File
@@ -11,8 +11,8 @@ import (
var stopallCmd = &cobra.Command{
Use: "stopall",
Short: "Stop and disable all running managed units",
Long: `Stopall runs 'systemctl disable --now' for all enabled, installed units.`,
Short: "Stop all installed units",
Long: `Stopall runs 'systemctl stop' for all installed units in reverse startup order.`,
RunE: runStopall,
}
@@ -46,7 +46,7 @@ func runStopall(cmd *cobra.Command, args []string) error {
continue
}
fmt.Printf(" ■ stopping: %s...\n", systemd.ServiceName(u, prefix, suffix))
if err := systemd.Disable(u, prefix, suffix); err != nil {
if err := systemd.Stop(u, prefix, suffix); err != nil {
fmt.Printf(" ✗ failed: %s: %v\n", u.Name, err)
failed++
} else {