We help IT Professionals succeed at work.
Get Started

Script to Monitor a Directory in Linux

369 Views
Last Modified: 2012-05-11
Hello,

I am looking to write a script on a Redhat system that will watch a folder for activity.  If no new files are created after 10 minutes it will do something (haven't decided what yet - email someone, send an alert of some kind)

Essentially there is a nightly process that kicks off at a certain time each day.  While it is running it is writing files to this directory indicating that various parts of the process have completed.  When it's finished it creates a file called End.txt signaling that it completed.  

So, the script I need would run until it sees that End.txt exists.  While it is running it would check for the timestamp of the newest file and compare it to the current time.  If the file is older than 10 minutes it would send the alert.  It would stop running once the End.txt is located.




Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE