一些shell脚本


#!/bin/sh
#set -x
src="/data/test/"
des_ip="192.168.1.232" 
#function
inotify_fun ()
{
/usr/bin/inotifywait -mrq --timefmt '%d/%m/%y-%H:%M' --format '%T %w%f' -e modify,delete,create,move $1|while read time file
do
	for ip in $des_ip
do
echo "`date +%Y%m%d-%T`: rsync -avzq --delete --partial --progress $1 $ip:`dirname $1`"
rsync -avzq --delete --partial --progress $1 $ip:`dirname $1`     #将当下目录不需要同步的文件写入exclude_file
echo
done
done
}
#main
for a in $src
do
inotify_fun $a &
done


你可能感兴趣的:(shell)