Created
August 23, 2018 23:41
-
-
Save brutus/6f3cf4e5041fcf1071597603a76b3b7a to your computer and use it in GitHub Desktop.
scan trough qmail queue
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
#!/bin/bash | |
header_lines=${1:-10} | |
base_path=${2:-'/var/qmail-relay'} | |
for i in $( \ | |
${base_path}/bin/qmail-qread \ | |
| grep -Po '#\d+' \ | |
| cut -c2- | |
); do | |
echo looking for ${i} | |
mail_path="${base_path}/queue/mess/*/${i}" | |
ls ${mail_path} > /dev/null | |
if [ $? ]; then | |
mail_path=$(ls ${mail_path}) | |
echo | |
echo ------------------------------------ | |
head --lines ${header_lines} "${mail_path}" | |
echo ------------------------------------ | |
echo | |
else | |
echo ${i} not found | |
continue | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment