Commit 5d1a37ee authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Send MAINPID to systemd when reexecing for logfile output

This allows the new process to notify systemd when it is ready. Signed-off-by: 's avatarBrad Davidson <brad.davidson@rancher.com>
parent a16105b3
......@@ -9,6 +9,7 @@ import (
"sync"
"time"
systemd "github.com/coreos/go-systemd/daemon"
"github.com/docker/docker/pkg/reexec"
"github.com/natefinch/lumberjack"
"github.com/rancher/k3s/pkg/version"
......@@ -98,7 +99,11 @@ func runWithLogging() error {
cmd.Stderr = l
cmd.Stdout = l
cmd.Stdin = os.Stdin
return cmd.Run()
if err := cmd.Start(); err != nil {
return err
}
systemd.SdNotify(false, fmt.Sprintf("MAINPID=%d\n", cmd.Process.Pid))
return cmd.Wait()
}
func setupLogging() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment