mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
Add -run-healthcheck flag
This flag is useful for some users that prefer a scratch image that cannot execute a bash healthcheck. Instead they can execute the watchdog itself such as: "watchdog -run-healthcheck" It will return a non-zero exit code for when the lock file is not found. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
parent
ba9ece8a86
commit
4d4ecc6bbf
@ -24,14 +24,30 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
versionFlag bool
|
||||
acceptingConnections int32
|
||||
)
|
||||
|
||||
func main() {
|
||||
var runHealthcheck bool
|
||||
var versionFlag bool
|
||||
|
||||
flag.BoolVar(&versionFlag, "version", false, "Print the version and exit")
|
||||
flag.BoolVar(&runHealthcheck,
|
||||
"run-healthcheck",
|
||||
false,
|
||||
"Check for the a lock-file, when using an exec healthcheck. Exit 0 for present, non-zero when not found.")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if runHealthcheck {
|
||||
if lockFilePresent() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "unable to find lock file.\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
printVersion()
|
||||
|
||||
if versionFlag {
|
||||
|
Loading…
x
Reference in New Issue
Block a user