Move nginx helper (#4501)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-08-30 20:18:11 -04:00 committed by GitHub
parent 8740c1b661
commit 72cb7f5e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View file

@ -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
}