Skip to content

Instantly share code, notes, and snippets.

@danwald
Created May 3, 2015 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danwald/9fa42275a152efee590f to your computer and use it in GitHub Desktop.
Save danwald/9fa42275a152efee590f to your computer and use it in GitHub Desktop.
Extract the last timestamp from a logfile and check if it was more than a minute ago
LOG_TS=$(tail -n 1000 __STR__ | grep INFO | tail -n 1 | grep -Po "\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}") && [[ $((`date +%s`-`date +%s -d"$LOG_TS"`)) -lt 60 ]] || echo "More than a minute"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment