Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-12-2006, 11:06 PM   #1
Registered: Dec 2004
Distribution: Slackware
Posts: 114

Rep: Reputation: 16
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.
Old 01-12-2006, 11:24 PM   #2
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,272

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
touch --date "now - 1 hour" filename


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
One Touch backup versus One Touch II q6supvr Linux - Software 4 12-16-2007 08:28 PM
Touch pad tapping question pgte3 Linux - General 2 09-28-2004 09:10 AM
Error - can't touch touch: /var/lock - filesystem problem? xanas3712 Linux - Newbie 0 05-10-2004 05:26 AM
Help with the TOUCH utility t3___ Linux - Software 25 02-18-2004 01:26 PM
touch question rewt Linux - General 1 08-05-2001 10:53 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration