bash - Monitor directory and change ownership of files upon creation -


i have tried method not work...

inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed 's/ create //g' |     while read file;     chown apache.apache $file     done 

from command line

inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed 's/ create //g' 

gives exact output need full path of file, moment try output sed file or pipe it's output else stops working.

can point me in right direction here?

by default, sed buffers output when it's writing pipe. use -u option unbuffer it.

inotifywait -mr -e create /opt/freeswitch/storage/ 2>&-| sed -u 's/ create //g' |     while read file;     chown apache.apache $file     done 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -