Originally Posted by xmdms
I am trying to write this script to monitor a log file within the last 10 lines and take the current time and subtracted by 15 minutes. I am stuck at the date calculation part.
Thu Oct 8 09:08:50 CDT 2009
I would like to know the syntax on how to take this time current time and subtracted by 15 minutes.
Well, what kind of script are you writing? Bash? Perl? Python?
The date command can do this for bash, read the man page. For example:
date --date="-1 days" +%Y%m%d
will bring you yesterdays date, in YYYYMMDD format.