我是
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