๐Ÿฆž Morning Report System cron + telegram

Daily automated security reports with inline button updates

Created: 13.03.2026  ยท  Server: domedog.pro  ยท  Schedule: 04:00, 05:00, 06:00 Europe/Ljubljana

๐Ÿ“‹ Overview

The Morning Report system runs three automated cron jobs that check server health, security status, and available updates. Reports are delivered to Telegram with clickable inline buttons for applying updates.

Cron Schedule

Time Job Purpose
04:00 daily-auto-update Auto-update skills, check OpenClaw updates
05:00 reboot-check Alert if kernel needs reboot (only on mismatch)
06:00 morning-health-report Full security report + update button

๐Ÿ”˜ Inline Buttons critical knowledge

โŒ WRONG: Text placeholder format

This does NOT render as a clickable button:

[inline_button:Apply Updates:apply_system_updates]

The user sees raw text, not a button.

โœ… CORRECT: Use openclaw message send with --buttons

Use the CLI command with JSON-formatted buttons:

Working Command

openclaw message send \
  --channel telegram \
  --target "85126311" \
  --buttons '[[{"text": "โœ… Apply Updates", "callback_data": "apply_system_updates"}]]' \
  -m "Your message here"

Button JSON Format

# Single button
--buttons '[[{"text": "Button Text", "callback_data": "action_name"}]]'

# Two buttons side by side
--buttons '[[{"text": "Yes", "callback_data": "yes"}, {"text": "No", "callback_data": "no"}]]'

# Two rows of buttons
--buttons '[[{"text": "Row 1", "callback_data": "r1"}],[{"text": "Row 2", "callback_data": "r2"}]]'

Key Points

๐Ÿ“ Telegram Message Formatting critical

โŒ WRONG: HTML tags show as raw text
๐Ÿฆž <b>Morning Health Report</b>
โœ… <b>SSH:</b> 211 attacks blocked

User sees: <b>Morning Health Report</b> (literal text)

โœ… CORRECT: Plain text with emoji
๐Ÿฆž Morning Health Report

โœ… SSH: 211 attacks blocked (fail2ban active)
๐Ÿ”ด OOM: 1 kill yesterday (opencode)
๐Ÿ“ฆ Updates: 25 packages ready

What Works

What Doesn't Work

๐Ÿ“Š Daily Security Report Script

Location: /home/clawdija/asistent/v2/workspace/daily-security-report.sh

What It Checks

  1. SSH attacks โ€” Failed password + invalid user attempts (24h)
  2. fail2ban โ€” Total bans, currently banned IPs
  3. OOM kills โ€” Processes killed by out-of-memory (24h)
  4. Package updates โ€” Security, regular, and vendor updates pending
  5. Failed services โ€” systemd units in failed state
  6. Disk usage โ€” Root partition percentage
  7. Memory usage โ€” RAM percentage
  8. Gateway status โ€” Is OpenClaw gateway running?

Update Signal

When updates are available, the script outputs:

[UPDATES_AVAILABLE:25]

The agent reads this signal and knows to send a message with an "Apply Updates" button.

โš™๏ธ Cron Job Configuration

Location: /home/clawdija/asistent/v2/cron/jobs.json

Morning Health Report Job

{
  "id": "c7c04792-76d1-46b6-a925-27151dfe12b8",
  "name": "morning-health-report",
  "enabled": true,
  "schedule": {
    "kind": "cron",
    "expr": "0 6 * * *"
  },
  "payload": {
    "kind": "agentTurn",
    "message": "Good morning! Run the daily security report:\n\n1. Execute ~/asistent/v2/workspace/daily-security-report.sh...\n2. Check for OpenClaw updates...\n3. Run memory-recall.sh recent 3...\n\nINLINE BUTTONS (IMPORTANT):\nIf updates available, use this EXACT command:\nopenclaw message send --channel telegram --target \"85126311\" \\\n  --buttons '[[{\"text\": \"โœ… Apply Updates\", \"callback_data\": \"apply_system_updates\"}]]' \\\n  -m \"Your plain text message\"\n\nDO NOT use [inline_button:...] or HTML tags.\n\nCALLBACK HANDLING:\n- When callback_data \"apply_system_updates\" received:\n  a) React with ๐Ÿ‘ first\n  b) Run ~/asistent/v2/workspace/system-update.sh\n  c) Report results"
  },
  "delivery": {
    "mode": "announce",
    "channel": "last"
  }
}

Key Configuration Points

Managing Cron Jobs

# List all cron jobs
openclaw cron list

# Edit a job
openclaw cron edit <job-id> --message "New prompt..."

# Run a job manually (debug)
openclaw cron run <job-id>

# View run history
openclaw cron runs --id <job-id>

๐Ÿ”” Callback Handling

When a user taps an inline button, the callback_data is sent to the agent. The agent must handle it appropriately.

Current Callbacks

callback_data Action Script
apply_system_updates Apply pending package updates ~/asistent/v2/workspace/system-update.sh

Callback Response Flow

  1. User taps button โ†’ Telegram sends callback to OpenClaw
  2. Agent receives โ†’ callback_data in message context
  3. Acknowledge first โ†’ React with ๐Ÿ‘ to confirm receipt
  4. Execute action โ†’ Run the appropriate script
  5. Report results โ†’ Send summary back to user
โš ๏ธ Acknowledgment Rule (from SOUL.md)

Every message deserves a response. When user sends a message or clicks a button:

  1. FIRST: React with ๐Ÿ‘ or send brief acknowledgment
  2. THEN: Do the work
  3. FINALLY: Report results

Telegram doesn't show delivery confirmations โ€” only the agent can confirm receipt.

๐Ÿ“ Related Files

File Purpose
~/asistent/v2/workspace/daily-security-report.sh Generates the security report
~/asistent/v2/workspace/system-update.sh Applies package updates
~/asistent/v2/workspace/reboot-check.sh Checks if kernel reboot needed
~/asistent/v2/cron/jobs.json Cron job definitions
~/asistent/v2/logs/daily-security-report.log Report execution logs

๐Ÿ”ง Troubleshooting

Button Not Rendering

Symptom: Message shows [inline_button:...] as text

Solution: Use openclaw message send --buttons '[[...]]' instead of text placeholder

HTML Tags Showing

Symptom: <b> shows literally in message

Solution: Remove HTML tags, use plain text with emoji

Duplicate Reports

Symptom: User receives multiple identical reports

Solution: Check if multiple cron jobs with same schedule exist: openclaw cron list

Button Callback Not Working

Symptom: User taps button but nothing happens

Solution: Verify callback handling is in cron job prompt, check agent received the callback

Cron Job Not Running

Symptom: No report at expected time

Solution: Check gateway is running, verify cron job enabled: openclaw cron list

๐Ÿ“– Quick Reference

Send Message with Button

openclaw message send \
  --channel telegram \
  --target "85126311" \
  --buttons '[[{"text": "โœ… Action", "callback_data": "action_name"}]]' \
  -m "Plain text message with emoji ๐Ÿฆž"

Run Report Manually

~/asistent/v2/workspace/daily-security-report.sh

Apply Updates Manually

~/asistent/v2/workspace/system-update.sh

Check Cron Status

openclaw cron list
openclaw cron runs --id c7c04792-76d1-46b6-a925-27151dfe12b8

Edit Cron Job

openclaw cron edit c7c04792-76d1-46b6-a925-27151dfe12b8 --message "New prompt"