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:
+4
-4
@@ -11,9 +11,9 @@ import (
|
||||
|
||||
var startallCmd = &cobra.Command{
|
||||
Use: "startall",
|
||||
Short: "Enable and start all installed, enabled units",
|
||||
Long: `Startall runs 'systemctl enable --now' for all enabled units that have
|
||||
been installed. Units must be installed first via 'unitdore install'.`,
|
||||
Short: "Start all installed, enabled units",
|
||||
Long: `Startall runs 'systemctl start' for all enabled units that have been installed.
|
||||
Units must be installed first via 'unitdore installall'.`,
|
||||
RunE: runStartall,
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func runStartall(cmd *cobra.Command, args []string) error {
|
||||
continue
|
||||
}
|
||||
fmt.Printf(" ▶ starting: %s...\n", systemd.ServiceName(u, prefix, suffix))
|
||||
if err := systemd.Enable(u, prefix, suffix); err != nil {
|
||||
if err := systemd.Start(u, prefix, suffix); err != nil {
|
||||
fmt.Printf(" ✗ failed: %s: %v\n", u.Name, err)
|
||||
failed++
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user