Tuesday, March 14, 2017

live netapp volume copy

 copy a netapp volume on a local system  
   
 create the volume. then:  
   
 > vol restrict vol_dst  
 > vol copy vol_src vol_dst <- ignoring snapshots  
   
 once console reports:  
 vol copy restore 0 : 100% done  
   
 > vol copy status  
 No operations in progress.  
   
 > vol online vol_dst  
   

Wednesday, March 8, 2017

ldapsearch and awk follies

 #!/bin/bash  
ldapsearch -x -D "CN=serviceacct,OU=here" -w n0tagain\!\!\! -h 6.6.6.6 -p 3268 
  -LLL "(&(objectCategory=person)(objectclass=user)(memberOf=CN=slack-here,OU=here))" 
   mail departmentNumber | awk '!/CN=/{print $2}' > yes ; awk 'NF > 0' yes > no ; 
   awk 'NR%2{printf "%s,",$0;next;}1' no > yes ; 
   mv yes output-here.`date +"%y%m%d"` ; rm -f no ;  
ldapsearch -x -D "CN=serviceacct,OU=there" -w alw4ys\@d0h\! -h 9.9.9.9 -p 3268 
   -LLL "(&(objectCategory=person)(objectclass=user)(memberOf=CN=slack-there,OU=there))" 
   mail description | awk '!/CN=/{print $2}' > yes ; awk 'NF > 0' yes > no ; 
   awk 'NR%2{printf "%s,",$0;next;}1' no > yes ; 
   awk -F, '{print $2,$1}' OFS=, yes > maybe ; 
   mv maybe output-there.`date +"%y%m%d"` ; rm -f no ; rm -f yes  
cat output-here.`date +"%y%m%d"` output-there.`date +"%y%m%d"` >> output-all.`date +"%y%m%d"` ;  
mailx -s "service users output.`date +"%y%m%d"`" me.in@hell <output-all.`date +"%y%m%d"` ;  
rm -f output-*