mirror of
https://github.com/minio/minio.git
synced 2025-07-08 08:32:18 -04:00
Restart process should use the current process' pid (#7373)
This fixes varying pids for server-respawns. And avoids duplicate process creating multiple pids when the server restart signal is triggered with service restart enabled. Fixes #7350
This commit is contained in:
parent
8e1e701d35
commit
89e45d0695
@ -19,6 +19,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Type of service signals currently supported.
|
// Type of service signals currently supported.
|
||||||
@ -56,9 +57,7 @@ func restartProcess() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass on the environment and replace the old count key with the new one.
|
// Invokes the execve system call.
|
||||||
cmd := exec.Command(argv0, os.Args[1:]...)
|
// Re-uses the same pid. This preserves the pid over multiple server-respawns.
|
||||||
cmd.Stdout = os.Stdout
|
return syscall.Exec(argv0, os.Args, os.Environ())
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
return cmd.Start()
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user