Bash public

systemd Timer Status

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/K83JZPS2STC8 | bash

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

At a glance

Script metadata

Slug
K83JZPS2STC8
Fetches
0
Size
1392 B · 52 lines
Expires
never
Last fetch
Created
2026-09-07 00:36:00.290
Description
Upcoming and last-run timers

Readable before runnable

Preview

#!/usr/bin/env bash
# Systemd timer status
# Read-only: systemctl list-timers. Does not install units or touch cron.
# Exit 0 if timers are listed, 1 if none or a last run failed, 2 if systemctl is missing.
# 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 "=== systemd timers ==="
note "Host:     $(hostname 2>/dev/null || printf unknown)"
if ! command -v systemctl >/dev/null 2>&1; then
  note "systemctl not found"
  note "Result: CRITICAL"
  exit 2
fi

table=$(systemctl list-timers --all --no-pager --no-legend 2>/dev/null || true)
count=$(printf '%s\n' "$table" | awk 'NF {n++} END {print n+0}')
systemctl list-timers --all --no-pager 2>/dev/null || true
note ""
note "Timers:   ${count}"

if [ "$count" -eq 0 ]; then
  note "          WARNING: no timers registered"
  bump warn
else
  failed=$(systemctl list-timers --all --no-pager --no-legend --plain 2>/dev/null | awk 'BEGIN{IGNORECASE=1} /failed/ {n++} END {print n+0}')
  if [ "${failed}" -gt 0 ]; then
    note "          WARNING: ${failed} timer row(s) mention failed"
    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/K83JZPS2STC8

See something unsafe?

Report this script

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

Restore revision