File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,15 +100,22 @@ Example watchdog script:
100100#! /bin/zsh
101101set -euo pipefail
102102
103- if openclaw health --json > /dev/null 2>&1 ; then
103+ # launchd uses a minimal PATH. Replace this if your install lives elsewhere
104+ # (for example nvm, pnpm, Homebrew on Apple Silicon, or a custom prefix).
105+ OPENCLAW_BIN=" ${OPENCLAW_BIN:-/ opt/ homebrew/ bin/ openclaw} "
106+
107+ if " $OPENCLAW_BIN " health --json > /dev/null 2>&1 ; then
104108 exit 0
105109fi
106110
107- openclaw doctor > /dev/null 2>&1 || true
108- openclaw doctor --fix > /dev/null 2>&1 || true
109- openclaw gateway restart > /dev/null 2>&1 || true
111+ " $OPENCLAW_BIN " doctor > /dev/null 2>&1 || true
112+ " $OPENCLAW_BIN " doctor --fix > /dev/null 2>&1 || true
113+ " $OPENCLAW_BIN " gateway restart > /dev/null 2>&1 || true
110114```
111115
116+ Before loading the watchdog, verify the binary path with ` which openclaw ` and
117+ update ` OPENCLAW_BIN ` if needed.
118+
112119Example LaunchAgent (` ~/Library/LaunchAgents/ai.openclaw.gateway-watchdog.plist ` ):
113120
114121``` xml
@@ -123,6 +130,11 @@ Example LaunchAgent (`~/Library/LaunchAgents/ai.openclaw.gateway-watchdog.plist`
123130 <string >/bin/zsh</string >
124131 <string >/Users/YOU/.openclaw/bin/gateway-watchdog.sh</string >
125132 </array >
133+ <key >EnvironmentVariables</key >
134+ <dict >
135+ <key >PATH</key >
136+ <string >/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string >
137+ </dict >
126138 <key >StartInterval</key >
127139 <integer >60</integer >
128140 <key >RunAtLoad</key >
You can’t perform that action at this time.
0 commit comments