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
Post a Comment