Skip to content

Instantly share code, notes, and snippets.

@yendor
Forked from dave1010/notify-apache-errors.sh
Created November 14, 2011 05:08
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 yendor/1363287 to your computer and use it in GitHub Desktop.
Save yendor/1363287 to your computer and use it in GitHub Desktop.
notify-apache-errors.sh
#!/bin/bash
# use ubuntu's notification system to let us know when there's something new in the apache error log
TAIL=/usr/bin/tail
if [ -x /usr/bin/inotail ]; then
TAIL="/usr/bin/inotail"
fi
$TAIL -n0 -f /var/log/apache2/error.log | while read line
do
body=`echo $line | cut -f 9- -d ' '`
notify-send -c im.received -i error "Apache / PHP error" "$body"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment