Created
August 6, 2018 10:52
-
-
Save wayneashleyberry/57303130ff5359ec479d7793f7ab6fd9 to your computer and use it in GitHub Desktop.
package for creating probe files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package probe | |
import "os" | |
const liveFile = "/tmp/live" | |
// Create will create a file for the liveness check | |
func Create() error { | |
_, err := os.Create(liveFile) | |
return err | |
} | |
// Remove will remove the file create for the liveness probe | |
func Remove() error { | |
return os.Remove(liveFile) | |
} | |
// Exists checks if the file created for the liveness probe exists | |
func Exists() bool { | |
if _, err := os.Stat(liveFile); err == nil { | |
return true | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment