Skip to content

Instantly share code, notes, and snippets.

@rossigee
Created February 6, 2015 04:39
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 rossigee/44b9287e95068ebb9ae1 to your computer and use it in GitHub Desktop.
Save rossigee/44b9287e95068ebb9ae1 to your computer and use it in GitHub Desktop.
Checks number of seconds since a file was changed
#!/bin/bash
#
# Returns (via stdout) the number of seconds since a file was last changed. Useful for checking a
# 'success' timestamp/flag file to identify a stale/dead process.
#
echo $[`date +%s` - `stat -c %Y $1`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment