Created
September 6, 2018 06:26
-
-
Save kentatogashi/304b58dcd4e29bafb1f278fce2ed388a to your computer and use it in GitHub Desktop.
easy_postcat.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/bash | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin | |
TYPE="$1" | |
CNT=1 | |
SAMPLING_NUM=50 | |
postqueue -p | tail -${SAMPLING_NUM} | awk '{print $1}' | egrep '^[A-Z0-9]{11}' | while read QUEUE_ID; | |
do | |
echo "queue: $CNT" | |
if [ "$TYPE" = --detail ] | |
then | |
postcat -q $QUEUE_ID | |
else | |
postcat -q $QUEUE_ID | egrep '(recipient:|Received:|Subject:)' | |
fi | |
echo | |
let ++CNT | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment