Skip to content

Instantly share code, notes, and snippets.

@goncha
Last active October 11, 2015 19:38
Show Gist options
  • Save goncha/3909494 to your computer and use it in GitHub Desktop.
Save goncha/3909494 to your computer and use it in GitHub Desktop.
forward gzipped error mail to remote address
############
# ~/.forward
############
"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #${USER}"
###############
# ~/.procmailrc
###############
:0 Bc
* error
| ${HOME}/bin/forward
###############
# ~/bin/forward
###############
#!/bin/sh
FILE=$(mktemp mail.XXXXXXXXXX.txt.gz)
gzip >> "${FILE}"
mutt -x -s "Error mail from ${LOGNAME}@${HOSTNAME}" -a "${FILE}" -- 'YOUR_MAIL_ADDRESS'
rm -f "${FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment