Bash public

Journal Error Tail

Share this script safely, inspect its metadata, and copy the exact command you need.

Dashboard

Ready to run

One-liner

Copy the command, then review before execution.
curl -fsSL https://runny.sh/r/SWJVAJMG2RMQ | bash

Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.264

At a glance

Script metadata

Slug
SWJVAJMG2RMQ
Fetches
0
Size
1275 B · 50 lines
Expires
never
Last fetch
Created
2026-09-07 00:35:59.546
Description
Recent error and critical journal lines

Readable before runnable

Preview

#!/usr/bin/env bash
# Journal error tail
# Read-only: last 20 err/crit journal lines when journalctl exists.
# Exit 0 if none, 1 if errors are present, 2 if journalctl is missing or fails.
# Hosted on Runny.sh. Review the script page before you run it.

set -u

status=0
note() { printf '%s\n' "$*"; }
bump() {
  case $1 in
    crit) status=2 ;;
    warn) [ "$status" -lt 1 ] && status=1 ;;
  esac
}

note "=== Recent journal errors ==="
note "Host:     $(hostname 2>/dev/null || printf unknown)"
if ! command -v journalctl >/dev/null 2>&1; then
  note "journalctl not found (not a systemd journal host)"
  note "Result: WARNING"
  exit 1
fi

rows=$(journalctl -p err -n 20 --no-pager --output=short 2>/dev/null || true)
if [ -z "${rows}" ]; then
  note "journalctl returned no output (empty journal or access denied)"
  bump warn
else
  printf '%s\n' "$rows"
  count=$(printf '%s\n' "$rows" | awk 'NF && $0 !~ /^--/ {n++} END {print n+0}')
  note ""
  note "Lines:    ${count}"
  if [ "$count" -gt 0 ]; then
    note "          WARNING: error-priority records in the last 20 lines"
    bump warn
  else
    note "          OK"
  fi
fi
note ""

case $status in
  0) note "Result: HEALTHY" ;;
  1) note "Result: WARNING" ;;
  *) note "Result: CRITICAL" ;;
esac
exit "$status"

Raw endpointhttps://runny.sh/r/SWJVAJMG2RMQ

See something unsafe?

Report this script

Tell us why it should come down. Anyone can also report a URL at /abuse.

Restore revision