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

html - Cut text on left side inside button while centering -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -