I have written the following script that later I want to put in cron,:
#!/bin/bash
_find="/usr/bin/find"
_paths="/moneta_polled01/mediation_gsm /moneta_polled01/mediation_mmsc"
for d in $_paths
do
$_find $d -type f -exec chmod 777 {} \;
done
but it does not seem to be working for the second subdirectory define on line 3.
There is no reason it not executing unless and that you say nothing, you are not executing the script as root.. in which case it cannot change what doesnt belong to the UID running the script...
It looks like its working, what I think is happening, is because these directories are being feed with files all the time, it looks like is not working, but it is.
But I dont quite understand why a cron entry with chmod command doest not work:
---------- Post updated at 03:10 PM ---------- Previous update was at 03:02 PM ----------
after removing "\" as suggested by vidyadhar85, I got the following:
./perm
+ _find=/usr/bin/find
+ _paths='/moneta_polled01/mediation_gsm /moneta_polled01/mediation_mmsc'
+ for d in '$_paths'
+ /usr/bin/find /moneta_polled01/mediation_gsm -type f -exec chmod 777 '{}'
/usr/bin/find: incomplete statement
+ for d in '$_paths'
+ /usr/bin/find /moneta_polled01/mediation_mmsc -type f -exec chmod 777 '{}'
/usr/bin/find: incomplete statement
ant:/home/vbe $ find . -xdev -size +10000000c -exec ls -ld {} ;
find: -exec not terminated with ';'
ant:/home/vbe $ find . -xdev -size +10000000c -exec ls -ld {} \;
-rw-rw-rw- 1 vbe bin 78273744 Jan 20 2009 ./AdbeRdr709_hpux_enu.tar.gz
find: cannot open ./.test
Remember: We were not talking about variable substitution... If you are correct in absolute : the syntax requires ; the shell straight away will interpret therefore the use of \ , but here we were on command line... in a script, look the beginning...