Sistemas‎ > ‎Linux‎ > ‎Scripts Linux‎ > ‎Postfix / Qmail‎ > ‎

achaQmail.sh

#!/bin/bash
# Procura palavra chave dentro de todos arquivos .qmail
# achaQmail.sh silvio

echo "" > /root/achaQmail.log

for i in `ls /home/remote`
do
#  echo "/home/remote/$i/.qmail" >> /root/achaQmail.log
  EMAIL=`find /home/remote/$i/.qmail | xargs grep -s -a -i "$1" | cut -d : -f 1 | uniq`
  if [ "$EMAIL" != "" ]; then
    echo "/home/remote/$i/.qmail" >> /root/achaQmail.log
    echo $EMAIL >> /root/achaQmail.log
  fi
done

clear
more /root/achaQmail.log

Comments