我是
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
原文地址:https://www.jb51.cc/linux/393704.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。