Skip to content

Instantly share code, notes, and snippets.

@Eeemil
Created March 4, 2019 13:53
Show Gist options
  • Save Eeemil/7695024a19c909881d83765113574672 to your computer and use it in GitHub Desktop.
Save Eeemil/7695024a19c909881d83765113574672 to your computer and use it in GitHub Desktop.
Script to use in probes in Kubernetes to determine that a health file is modified within the last minute
#!/bin/sh
# Returns 0 if health file has been modified within the last minute
# Otherwise return non-zero
# Usage: ./probe.sh [health-file]
HEALTH_FILE=${1:-"/opt/app/alive.txt"}
test $(find ${HEALTH_FILE} -mmin -1)
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment