Skip to content

Instantly share code, notes, and snippets.

@wayneashleyberry
Created August 6, 2018 10:52
Show Gist options
  • Save wayneashleyberry/57303130ff5359ec479d7793f7ab6fd9 to your computer and use it in GitHub Desktop.
Save wayneashleyberry/57303130ff5359ec479d7793f7ab6fd9 to your computer and use it in GitHub Desktop.
package for creating probe files
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