Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chrisshennan/506fb139a7bdf5d735c8 to your computer and use it in GitHub Desktop.
Save chrisshennan/506fb139a7bdf5d735c8 to your computer and use it in GitHub Desktop.
How-To: Tail Apache logs to Ubuntu Notifications
sh watch-apache-log.sh > /dev/null 2>&1 &
#!/bin/sh
apache_log() {
while inotifywait -e modify /var/log/apache2/error.log; do
line=$(tail -n1 /var/log/apache2/error.log | cut -c 81-);
notify-send "$line";
done
}
apache_log &
#!/bin/sh
apache_log() {
while inotifywait -e modify /var/log/apache2/*.error.log; do
line=$(tail -n1 /var/log/apache2/*.error.log | cut -c 81-);
notify-send "$line";
done
}
apache_log &
#!/bin/sh
apache_log() {
while inotifywait -e modify /var/log/apache2/error.log; do
line=$(tail -n1 /var/log/apache2/error.log | cut -c 81-);
notify-send "$line";
done
}
mail_log() {
while inotifywait -e modify /var/log/mail.log; do
line=$(tail -n1 /var/log/mail.log);
notify-send "$line";
done
}
apache_log &
mail_log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment