set shell := ["bash", "-eu", "-o", "pipefail", "-c"]

default:
  @just --list

# Install or update all systemd units and enable the daily export timer.
install:
  run0 python3 systemd/install.py --enable

# Show whether the systemd timer is enabled and when it will next run.
status:
  run0 python3 systemd/install.py --status

# Fire the same service used by the daily timer (exports yesterday's log).
fire:
  run0 python3 systemd/install.py --fire

# Export today's currently available atop history without waiting for midnight.
test-today:
  modal run modal_atop_analyze.py --date "$(date +%Y%m%d)" --initialize

# Inspect the most recent scheduled-export output.
logs:
  journalctl -u atop-modal-export.service --no-pager -n 100

# Inspect recent logs emitted by the remote Modal ingestion function.
logs-modal:
  modal app logs atop-analyze --since 24h --tail 100 --timestamps

# Show the Modal app's local-entrypoint arguments.
help:
  modal run modal_atop_analyze.py --help
