2017年10月25笔记

来源:互联网 发布:mac fontawesome 字体 编辑:程序博客网 时间:2024/06/15 11:38

Centos7安装 gcc编译器  http://blog.csdn.net/gw85047034/article/details/52957516

Centos7配置yum源  http://blog.csdn.net/lcj200813138020/article/details/46914161

http://www.ttlsa.com/web/let-infotify-rsync-fast/  inotify+rsync同步方案

inotify的使用  http://blog.csdn.net/god_wot/article/details/50448814

    • 可取之处为使用脚本
      [root@iZ25w1kdi5zZ scripts]# vi inotify_start.sh  
      /usr/local/inotify/bin/inotifywait -mrq -e modify,create,move,delete \                                 -m:monitor    r:recursive  q:quiet  e:events
      --fromfile '/opt/scripts/ffile' \ 意为监控ffile下面的目录  ffile中内容为 /root
      --timefmt '%y-%m-%d %H:%M' --format '%T %w %f %e' \  生成的inotify.log的格式     17-10-25 17:31/root/test/dir/ dfile CREATE
      --outfile '/tmp/rsync.log'  生成log位置

      inotify打印说明:

      前提:对root目录下的文件和文件夹操作

      [root@localhost ~]# vi /tmp/rsync.log
      17-10-25 17:31 dfile CREATE
      17-10-25 17:31 /root/test/dir/ dfile CREATE   可以具体到目标文件位置  这样在通过rsync来同步指定的文件就使rsync效率高多了 

 让程序在后台运行:   

 [root@localhost ~]# sh /opt/scripts/inotify_start.sh
^Z                                                                                                             ----:让前台程序在停止
[1]+  Stopped                 sh /opt/scripts/inotify_start.sh
[root@localhost ~]# jobs -l                                                                 ----:查看当前jobs
[1]+ 27978 Stopped                 sh /opt/scripts/inotify_start.sh
[root@localhost ~]# bg 1                                                                   ---:指定job号为1的进程在后台运行,相当于 &
[1]+ sh /opt/scripts/inotify_start.sh &
[root@localhost ~]# jobs -l             
[1]+ 27978 Running                 sh /opt/scripts/inotify_start.sh &
[root@localhost ~]# fg  1                                                                   ---:调用后台进程在前台执行
sh /opt/scripts/inotify_start.sh














原创粉丝点击