Move nginx helper (#4501)
This commit is contained in:
parent
8740c1b661
commit
72cb7f5e14
3 changed files with 14 additions and 13 deletions
|
@ -414,7 +414,7 @@ func (n *NGINXController) Stop() error {
|
|||
// wait for the NGINX process to terminate
|
||||
timer := time.NewTicker(time.Second * 1)
|
||||
for range timer.C {
|
||||
if !process.IsNginxRunning() {
|
||||
if !nginx.IsRunning() {
|
||||
klog.Info("NGINX process has stopped")
|
||||
timer.Stop()
|
||||
break
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
ps "github.com/mitchellh/go-ps"
|
||||
"github.com/ncabatoff/process-exporter/proc"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
@ -82,14 +81,3 @@ func WaitUntilPortIsAvailable(port int) {
|
|||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
// IsNginxRunning returns true if a process with the name 'nginx' is found
|
||||
func IsNginxRunning() bool {
|
||||
processes, _ := ps.Processes()
|
||||
for _, p := range processes {
|
||||
if p.Executable() == "nginx" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
ps "github.com/mitchellh/go-ps"
|
||||
"github.com/tv42/httpunix"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
@ -171,3 +172,15 @@ func Version() string {
|
|||
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// IsRunning returns true if a process with the name 'nginx' is found
|
||||
func IsRunning() bool {
|
||||
processes, _ := ps.Processes()
|
||||
for _, p := range processes {
|
||||
if p.Executable() == "nginx" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue