1
0
mirror of https://github.com/rancher/os.git synced 2025-09-13 13:39:53 +00:00

Fix dhcpcd zoombie issue

This commit is contained in:
niusmallnan
2018-11-01 16:06:06 +08:00
committed by niusmallnan
parent 716597f41a
commit bb5ce7ac23
3 changed files with 21 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ const (
var (
defaultDhcpArgs = []string{"dhcpcd", "-MA4"}
exitDhcpArgs = []string{"dhcpcd", "-x"}
dhcpReleaseCmd = "dhcpcd --release"
)
@@ -527,5 +528,13 @@ func GetValidLinkList() ([]netlink.Link, error) {
}
return validLinkList, nil
}
func StopDhcpcd() {
cmd := exec.Command(exitDhcpArgs[0], exitDhcpArgs[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Errorf("Failed to run command [%v]: %v", cmd, err)
}
}