Thursday, October 23, 2014

will grep for food

although zless does the job, too.

so. my mx host changed. and you know a whole lot of my boxes simply do not not use smarthost for mail relay. that's okay. or is it?

not really. because all those hosts need to have their zillion hosts files and bizarro mail conf files updated. and of course i'm not using chef or puppet or using anything sane. who would do that? not me, of course.

but! i do backup etc directories in a central, safe place. i can totally grep them, right? no. they're all compressed.

zless to the rescue!

 #!/bin/bash  
 cd /safe/archive  
 for i in $( ls |grep tgz ); do  
     echo $i >> busted  
     zless $i | grep oldmailhost >> busted  
 done  

and then, knowing the tgz i can rgrep the snot out of it and find where that string resides. go to said server and grep -r away.

No comments: