#Script + Heartbeat
1 messages · Page 1 of 1 (latest)
Best pattern: don’t try to make the built-in heartbeat interval do the orchestration. Make your script the thing that owns the hourly schedule, then wake OpenClaw immediately after the script exits successfully.
So the flow is:
#!/usr/bin/env bash
set -euo pipefail
/path/to/your-script.sh
curl -X POST http://127.0.0.1:18789/hooks/wake \
-H "Authorization: Bearer $OPENCLAW_HOOK_TOKEN" \
-H "Content-Type: application/json" \
-d '{"text":"Hourly script finished successfully; run the heartbeat check now.","mode":"now"}'
Then schedule that wrapper hourly with systemd timer/cron. This guarantees ordering: script finishes → wake event fires → main session runs right away.
In OpenClaw, enable hooks with a dedicated token, e.g.:
{
hooks: {
enabled: true,
token: "shared-secret",
path: "/hooks",
},
agents: {
defaults: {
heartbeat: {
every: "0m" // optional: disable regular interval heartbeats if this wrapper is the only trigger
}
}
}