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

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

概述我是 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 s 我是 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 linedo    echo $linedone
总结

以上是内存溢出为你收集整理的连续监视linux中的目录,并在新文件可用时通知全部内容,希望文章能够帮你解决连续监视linux中的目录,并在新文件可用时通知所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存