Skip to content

Instantly share code, notes, and snippets.

@brutus
Created August 23, 2018 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brutus/6f3cf4e5041fcf1071597603a76b3b7a to your computer and use it in GitHub Desktop.
Save brutus/6f3cf4e5041fcf1071597603a76b3b7a to your computer and use it in GitHub Desktop.
scan trough qmail queue
#!/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