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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -