inotify java maven_INOTIFY 系列(一) 安装 和初步使用
題記: 最近需要監控linux下某個目錄下的文件變化,網友推薦了inotify.
目錄
一 環境
系統環境
軟件環境
二 安裝
安裝前檢查
2.源碼安裝
三 驗證
正文
一.環境
1.系統環境
CENTOS 6.6 內核 2.6.32
[root@scripts-1?usr]#?lsb_release?-a
LSB?Version:????:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor?ID:?CentOS
Description:????CentOS?release?6.6?(Final)
Release:????????6.6
Codename:???????Final
[root@scripts-1?usr]#?cat?/proc/version
Linux?version?2.6.32-504.el6.x86_64?(mockbuild@c6b9.bsys.dev.centos.org)?(gcc?version?4.4.7?20120313?(Red?Hat?4.4.7-11)?(GCC)?)?#1?SMP?Wed?Oct?15?04:27:16?UTC?2014
[root@scripts-1?usr]#
2. 軟件環境
inotify-tools-3.14
二 安裝
2.1 安裝前檢查
據說內核版本 必須 大于等于2.6.13 (筆者 未驗證內核版本小于2.6.13,也未找到官方資料 ,所以是據說)
2. 源碼安裝
tar?-zxvf?inotify-tools-3.14.tar.gz
cd?inotify-tools-3.14
ll
./configure?--prefix=/usr
make
make?install
三驗證
3.1 報錯?inotifywait: error while loading shared libraries: libinotifytools.so.0: cannot open shared object file: No such file or directory
[root@scripts-2?inotify-tools-3.14]#?inotifywait
inotifywait:?error?while?loading?shared?libraries:?libinotifytools.so.0:?cannot?open?shared?object?file:?No?such?file?or?directory
[root@scripts-2?inotify-tools-3.14]#
解決: 執行ldconfig
[root@scripts-2?inotify-tools-3.14]#?inotifywait
inotifywait:?error?while?loading?shared?libraries:?libinotifytools.so.0:?cannot?open?shared?object?file:?No?such?file?or?directory
[root@scripts-2?inotify-tools-3.14]#?ldconfig
[root@scripts-2?inotify-tools-3.14]#?inotifywait
No?files?specified?to?watch!
[root@scripts-2?inotify-tools-3.14]#
參考資料:
https://github.com/rvoicilas/inotify-tools/wiki
http://www.ibm.com/developerworks/cn/linux/l-ubuntu-inotify/index.html
http://www.infoq.com/articles/inotify-linux-file-system-event-monitoring
總結
以上是生活随笔為你收集整理的inotify java maven_INOTIFY 系列(一) 安装 和初步使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java 求1000以内的同构数_求
- 下一篇: java keygenerator_sp