Skip to content

Instantly share code, notes, and snippets.

@mschuerig
Created July 18, 2014 14:50
Show Gist options
  • Save mschuerig/0ad492b402ce561d88f3 to your computer and use it in GitHub Desktop.
Save mschuerig/0ad492b402ce561d88f3 to your computer and use it in GitHub Desktop.
Print errors logged by journald. Regularly call from cron.
#! /bin/sh -e
STATE=/var/local/exclaim-errors.state
now=$( date +'%Y-%m-%d %H:%M:%S' )
since="$(head -n1 $STATE 2>/dev/null || echo 2000-01-01)"
echo "$now" > $STATE
journalctl --priority=err --since="$since" | tail -n+2
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment