20080422

Recursive tasks unix style

I had to update a php file and each php file is under a different folder. A folder represents a site I'm updating:

site1.com
site2.net
site3.com.tw

so, I had to:

for j in *; do echo $j; cd $j/html && (for i in `find . -name "configuration.php"` ; do chflags noschg $i; perl -pi.bak -e 's/apache/apache2/g' $i; chflags schg $i; done; ) && cd ../.. ; done

I needed two loops as find would crap out because of the extra deep directory structure. Or maybe there's a flag to tell find not to go eny deeper than 1?

You might be wondering what's the chflags is for. It's an extra measure it won't get overwritten by Apache even if the the owner is root:wheel.

20080403

Securing RedHat Linux

From the "it-might-be-useful" department:

http://www.puschitz.com/SecuringLinux.shtml