Last active
August 29, 2015 14:02
-
-
Save rankun203/03e3bbc1db9aa9489236 to your computer and use it in GitHub Desktop.
监视文件夹并执行操作
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#author [email protected] | |
#ref http://unix.stackexchange.com/a/24955 | |
cd /home/rankun203 | |
inotifywait -r -m ./www -e create -e moved_to | | |
while read path action file; do | |
echo "The file '$file' appeared in directory '$path' via '$action'" | |
rsync -avzrhu --update --progress --chmod=u+rwx,g+rwx,o+rwx "$path$file" [email protected]:/home/rankun203/html/files | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update, -h: human readable.