mirror of
https://github.com/rancher/os.git
synced 2025-07-13 06:34:04 +00:00
Stop docker and console first to avoid zombie processes
This commit is contained in:
parent
3c998bef45
commit
cf3535458e
@ -25,6 +25,14 @@ func switchConsoleAction(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stop docker and console to avoid zombie process
|
||||||
|
if err = project.Stop(context.Background(), 10, "docker"); err != nil {
|
||||||
|
log.Errorf("Failed to stop Docker: %v", err)
|
||||||
|
}
|
||||||
|
if err = project.Stop(context.Background(), 10, "console"); err != nil {
|
||||||
|
log.Errorf("Failed to stop console: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if newConsole != "default" {
|
if newConsole != "default" {
|
||||||
if err = compose.LoadSpecialService(project, cfg, "console", newConsole); err != nil {
|
if err = compose.LoadSpecialService(project, cfg, "console", newConsole); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -41,8 +49,8 @@ func switchConsoleAction(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = project.Restart(context.Background(), 10, "docker"); err != nil {
|
if err = project.Start(context.Background(), "docker"); err != nil {
|
||||||
log.Errorf("Failed to restart Docker: %v", err)
|
log.Errorf("Failed to start Docker: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user