Skip to content

Instantly share code, notes, and snippets.

@darookee
Created January 21, 2016 21:06
Show Gist options
  • Select an option

  • Save darookee/0d677a44eecc711fbdb0 to your computer and use it in GitHub Desktop.

Select an option

Save darookee/0d677a44eecc711fbdb0 to your computer and use it in GitHub Desktop.
Check for large mailq, stop postfix, send pusbullet notification
#!/bin/bash
mailsinqueue=$(mailq 2> /dev/null|egrep "^[A-Z0-9]{11}[[:space:]].*" -c)
if [ "$mailsinqueue" -gt "15" ]; then
postfix status 1&>2 > /dev/null || exit 0
postfix stop 1&>2 > /dev/null
echo "SPAM!" | /usr/bin/pb 2> /dev/null
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment