On Tuesday 21 February 2012, lynn wrote:
On 21/02/12 01:37, Ruediger Meier wrote:
On Tuesday 21 February 2012, Ruediger Meier wrote:
On Monday 20 February 2012, lynn wrote:
share=/home/CACTUS/dropbox/ cd $share wihile true do if [ -N $share ]; then for a in * do if [ -N $a ]; then echo $(chmod g+w $a) echo "$a was changed" fi done fi sleep 4 done
B
Each time only one file has been modified. Why does it change _all_ of the files?
Just change only files without the wanted permissions find "$share" ! -perm -g=w -print0 | xargs -0 chmod g+w
better find "$share" ! -perm -g=w -print0 | xargs -r -0 chmod g+w to avoid error if no file is found.
This also corrects any quoting issues in case there are strange file names.
Very neat. Should I test before doing the find?
It's not needed because find "" .... does not find anything and nothing will be chmoded.
#!/bin/sh share=/home/CACTUS/dropbox/ while true do if [ -N $share ]; then find "$share" ! -perm -g=w -print0 | xargs -r -0 chmod g+w fi sleep 4 done
As the other files will already be rw, is there a way to 'only do the find if a new file has been created'?
You could try the inotify-tools package, something like while inotifywait -r -e "$share" ;do ... ;done (I've never used it in practice so far.) The best way would be IMO to mount "$share" with the right umask somehow like Michael mentioned in the other post. So you wouldn't need your script at all. cu, Rudi
Thanks, L x -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org