LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Touch Question (https://www.linuxquestions.org/questions/linux-newbie-8/touch-question-402732/)

ddu_ 01-12-2006 11:06 PM

Touch Question
 
Hi guys,

I'm not really sure where to post this question, so I figured I'd give it a shot here first.

I'd like to write a script to compare the modification time of filea to fileb, and if file b is younger, email the admin. To do this, I figured I'd touch a file with a modification time older than the time I want the younger file checked.

For example...I want the script to create a file 60 min old.
(This is hopefully where you guys can help!)
have it compare to a file that already exists, and if the existing file has been modified within the 60 min, the admin get an email. then, the touch file is removed. this would be run by crontab every 60 min of course.

So, with that idea, starting at square one, I was hoping someone could tell me how to create a file and have the modification time be 60 min ago.

Thanks in advance..sorry if this is confusing, Im new to this and still trying to work it out in my head myself.

haertig 01-12-2006 11:24 PM

Code:

touch --date "now - 1 hour" filename


All times are GMT -5. The time now is 02:49 PM.