Datetime sanity check
a guest Jan 21st, 2012 341 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
- now=`date +%s`
- filetime=`stat -f %m $me`
- if [ "$now" -lt "$filetime" ]; then
- echo "System time is too old. Updating system time."
- date -f %s $filetime
- # Touch the file to update the mtime.
- touch $me
RAW Paste Data