连续监视linux中的目录,并在新文件可用时通知

我是 linux和脚本环境的启动器.我的要求是这样的:
1) From an asp.net application,a file will be generated and copied
   to a predefined folder in a linux server machine. (I'm assuming this
   can be done by remote file sharing using samba server)

2) A service or script or whatever should be there in linux machine
   to track continuously whether file is available.

3) Once a new file is available,just parse the file,extract some
   input variables and execute a shell script based on these
   parameters.

我的问题在于第2点. – >如何编写应该连续执行的服务或脚本,并监视某个文件夹中的文件是否可用?

搜索了很多,有很多链接,我很困惑什么是最简单的方法来做到这一点.因为我不想在这里花费大量的编码作为脚本进一步执行,asp.net应用程序更重要,这应该是之间的连接器.

任何人都可以指导我正确的方式.如果以前有类似的问题,请分享链接,因为我找不到类似的东西.

解决方法

I dont want to spend lot of coding here

你正在寻找类似于inotify的东西.

[cnicutar@ariel ~]$inotifywait -m -e create ~/somedir/
Setting up watches.
Watches established.
/home/cnicutar/somedir/ CREATE somefile

例如,您可以在循环中执行此操作:

inotifywait -m -e create ~/somedir/ | while read line
do
    echo $line
done

相关文章

1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...
1 删除0字节文件 find -type f -size 0 -exec rm -rf {} ...
## 步骤 1:安装必要的软件包 首先,需要确保系统已安装 `dh...