Last active
November 14, 2016 21:34
-
-
Save flickerfly/1414a69d3a51c739048b0aeb031390ab to your computer and use it in GitHub Desktop.
Show the PHP scripts sending email currently in the queue of a postfix server
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 | |
# This works only if postfix is running. It is complete, but when dealing with large queues due to spam loads,etc., it can take a long time | |
#mailq |cut -f 1 -d " "|egrep -v "^\(|^$|^-|\*" |xargs postcat -q |grep "X-PHP-Originating-Script"|sort|uniq | |
# This will work when postfix is not running. It may run faster, but it may also get stuck due to long argument lists. | |
postcat /var/spool/postfix/maildrop/* |grep "X-PHP-Originating-Script"|sort|uniq | |
postcat /var/spool/postfix/*/* |grep "X-PHP-Originating-Script"|sort|uniq | |
postcat /var/spool/postfix/*/*/* |grep "X-PHP-Originating-Script"|sort|uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment