inotify工具安裝配置

1、安裝服務器

1)  從內核和目錄裏面查看是否支持inotifyless

[root@nfs01 ~]# uname -rspa

2.6.32-573.el6.x86_64code

[root@nfs01 ~]# ls -l /proc/sys/fs/inotify/    -→主要查看下面有沒有三個目錄server

總用量 0blog

-rw-r--r-- 1 root root 0 1月  21 13:03 max_queued_events遞歸

-rw-r--r-- 1 root root 0 1月  21 13:03 max_user_instances事件

-rw-r--r-- 1 root root 0 1月  21 13:03 max_user_watchesget

2)檢查是否有安裝inotify 若是沒有就安裝it

rpm -qa inotify-tools

沒有就先安裝epol源

yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

以後安裝

[root@nfs01 ~]# yum install inotify-tools -y

2、參數講解、

[root@nfs01 ~]# which inotifywait

/usr/bin/inotifywait

[root@nfsserver inotify-tools]# bin/inotifywait —help

 

r :遞歸查詢目錄

q:打印不多的信息,僅僅打印監控事件的信息  安靜狀態

m:始終保持事件監聽狀態

excluder#排除文件或者目錄的時候不區分大小寫

timefmt:指定時間輸出的格式

d :後臺運行

-e: 事件 裏面有不少方法

 

下面是事件參數

Events:

        access          file or directory contents were read   訪問

        modify          file or directory contents were written  修改

        attrib          file or directory attributes changed  屬性發生變化

        close_write     file or directory closed, after being opened in  寫入以後關閉

                        writeable mode

        close_nowrite   file or directory closed, after being opened in  

                        read-only mode

        close           file or directory closed, regardless of read/write mode 

        open            file or directory opened

        moved_to        file or directory moved to watched directory  移動到哪裏

        moved_from      file or directory moved from watched directory

        move            file or directory moved to or from watched directory

        create          file or directory created within watched directory

        delete          file or directory deleted within watched directory

        delete_self     file or directory was deleted

        unmount         file system containing file or directory unmounted卸載

以後就能夠和nfs共享服務器之間的實時備份

相關文章
相關標籤/搜索