Solved

How to get notifed of a new file

Posted on 2011-09-14
2
327 Views
Last Modified: 2012-05-12
Hi Experts,

I want to get a notification when a particular file is created in a particular directory.  I am using Linux.  I don't want to poll.  Is there a way to do it?
0
Comment
Question by:ambuli
2 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 250 total points
Comment Utility
Have a look at inotify :

        http://en.wikipedia.org/wiki/Inotify

It allows you to do exactly what you need.
0
 
LVL 1

Assisted Solution

by:bitsmakebytzesrun
bitsmakebytzesrun earned 250 total points
Comment Utility
have you considered doing a file listing/grep in cron?

this will run the check every 10 minutes,  the mail -E flag does not send messages with empty bodies (ie file not found).  you may need to sub /bin, /usr/bin with appropriate local paths or just use ls/mail without path if you have them defined in cron.

crontab -e:

*/10    *       *       *       *       /bin/ls -a | grep "filename" | /usr/bin/mail -Es "1" me@gmail.com
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now