troubleshooting Question

Script to Monitor a Directory in Linux

Avatar of ITApprendista
ITApprendista asked on
Linux OS DevShell Scripting
6 Comments1 Solution371 ViewsLast Modified:

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.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros