Update entrypoint.sh
Browse files- entrypoint.sh +10 -3
entrypoint.sh
CHANGED
|
@@ -28,7 +28,8 @@ mkdir -p /home/user/.openclaw
|
|
| 28 |
|
| 29 |
RETRIES=5
|
| 30 |
i=0
|
| 31 |
-
|
|
|
|
| 32 |
if [ -d /data ] && touch /data/.write-test 2>/dev/null; then
|
| 33 |
rm -f /data/.write-test
|
| 34 |
OPENCLAW_HOME=/data
|
|
@@ -43,7 +44,9 @@ while [ $i -lt $RETRIES ]; do
|
|
| 43 |
fi
|
| 44 |
done
|
| 45 |
|
| 46 |
-
if [ "$
|
|
|
|
|
|
|
| 47 |
warn "/data not writable after ${RETRIES}s - using ephemeral /home/user"
|
| 48 |
fi
|
| 49 |
|
|
@@ -186,7 +189,11 @@ clear_stale_locks
|
|
| 186 |
run_doctor
|
| 187 |
if doctor_locked; then
|
| 188 |
warn "doctor blocked by state ownership lock - diagnostics follow"
|
| 189 |
-
log "now (UTC): $(date -u +%Y-%m-%dT%H:%M:%S)"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
dump_owner "$STATE_DB" 2>/dev/null
|
| 191 |
find "$OPENCLAW_HOME/.openclaw/tmp" -maxdepth 3 2>/dev/null | head -n 30
|
| 192 |
warn "retrying doctor in 30s..."
|
|
|
|
| 28 |
|
| 29 |
RETRIES=5
|
| 30 |
i=0
|
| 31 |
+
USE_LOCAL_STATE="${USE_LOCAL_STATE:-1}"
|
| 32 |
+
while [ "$USE_LOCAL_STATE" != "1" ] && [ $i -lt $RETRIES ]; do
|
| 33 |
if [ -d /data ] && touch /data/.write-test 2>/dev/null; then
|
| 34 |
rm -f /data/.write-test
|
| 35 |
OPENCLAW_HOME=/data
|
|
|
|
| 44 |
fi
|
| 45 |
done
|
| 46 |
|
| 47 |
+
if [ "$USE_LOCAL_STATE" = "1" ]; then
|
| 48 |
+
log "USE_LOCAL_STATE=1 - live state on local disk (/home/user); /data is left untouched"
|
| 49 |
+
elif [ "$OPENCLAW_HOME" = "/home/user" ]; then
|
| 50 |
warn "/data not writable after ${RETRIES}s - using ephemeral /home/user"
|
| 51 |
fi
|
| 52 |
|
|
|
|
| 189 |
run_doctor
|
| 190 |
if doctor_locked; then
|
| 191 |
warn "doctor blocked by state ownership lock - diagnostics follow"
|
| 192 |
+
log "now (UTC): $(date -u +%Y-%m-%dT%H:%M:%S)" log "processes in this container:"
|
| 193 |
+
for p in /proc/[0-9]*; do
|
| 194 |
+
c=$(tr '\0' ' ' < "$p/cmdline" 2>/dev/null)
|
| 195 |
+
[ -n "$c" ] && echo "[proc] ${p#/proc/}: $(echo "$c" | cut -c1-160)"
|
| 196 |
+
done
|
| 197 |
dump_owner "$STATE_DB" 2>/dev/null
|
| 198 |
find "$OPENCLAW_HOME/.openclaw/tmp" -maxdepth 3 2>/dev/null | head -n 30
|
| 199 |
warn "retrying doctor in 30s..."
|