Files
Knowledge/chat-topics/systemd-heartbeat-config.md
T
2026-05-05 09:40:28 +10:00

83 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Checkpoint: Systemd PATH Fix + Heartbeat Consolidation
**Date:** 2026-04-06
**Session:** Main (Telegram)
---
## Context
Michael asked about whether OpenClaw could see inside the `openclaw.json` gateway config. This led to a broader discussion about heartbeat vs cron for multi-task intelligence gathering (email triage, weather, calendar, news, blog alerts, step/health monitoring).
---
## Key Decisions Made
### 1. Heartbeat Consolidation (✅ Done)
**Old approach:** 9 separate cron jobs, 6 delivering to Telegram throughout the day.
**New approach:** 1 consolidated heartbeat every 45 min, 6am9pm Sydney, with internal checks for:
- Home monitor (motion/camera changes)
- Email inbox scan (personal emails only)
- Weather — Narooma (always report first beat of day; rain ≥10% or gusts ≥30 km/h triggers alert)
- Blog RSS scan (new articles)
- Real estate morning report (6am only)
**CRUD operations:**
- `Narooma Weather Day Update` cron → **disabled**
- All other crons → **left intact** (Michael disabled them himself)
- HEARTBEAT.md → **updated** with new weather logic
### 2. Heartbeat Config Change in openclaw.json (✅ Done)
**Before:**
- Every: 30m
- Active hours: 9:00 AM 10:00 PM
**After:**
- Every: 45m
- Active hours: 6:00 AM 9:00 PM
**Applied via:** direct JSON edit to `/home/openclaw/.openclaw/openclaw.json` → required manual `sudo systemctl restart openclaw` (Michael ran this)
### 3. OpenClaw CLI Not in PATH — Root Cause Identified
**Problem:** OpenClaw CLI (`openclaw`) lives at `/home/openclaw/.npm-global/bin/openclaw` but this directory was missing from the PATH in exec sessions, even though Michael's interactive shell has it set via `~/.bashrc`.
**Root cause:** systemd services don't source `~/.bashrc`. The `User=openclaw` directive in the systemd unit doesn't trigger a login shell — it just runs the binary directly with a minimal environment.
**Solution (proposed, pending Michael's action):** Add a drop-in systemd override at:
```
/etc/systemd/system/openclaw.service.d/path.conf
```
With content:
```
[Service]
Environment="PATH=/home/openclaw/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin"
```
Then reload: `sudo systemctl daemon-reload && sudo systemctl restart openclaw`
Michael also plans to add additional PATHs to this drop-in as needed.
---
## Pending Actions
| Action | Owner | Status |
|--------|-------|--------|
| Create systemd drop-in with PATH fix | Michael | Pending |
| Restart openclaw gateway after drop-in | Michael | Pending |
| Confirm `openclaw` CLI is reachable | Soren | Will verify once done |
---
## Notes
- All heartbeat checks use `bestEffort: false` except weather which uses `bestEffort: true`
- Real estate DB scrape cron (`5139e9b1`) runs independently at 6am — no delivery, just DB update
- Security audit cron (`healthcheck:security-audit`) remains untouched — weekly Sunday 3am
- Michael confirmed he built the OpenClaw system himself (not auto-installed by a package manager)
- OpenClaw version: 2026.4.2