Spaces:
Running
Running
feat: trigger workspace state snapshot during graceful shutdown sequence
Browse files- start.sh +6 -0
- workspace-sync.py +5 -0
start.sh
CHANGED
|
@@ -412,6 +412,12 @@ fi
|
|
| 412 |
graceful_shutdown() {
|
| 413 |
echo ""
|
| 414 |
echo "🛑 Shutting down gracefully..."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
|
| 416 |
# Commit any unsaved workspace changes
|
| 417 |
if [ -d "/home/node/.openclaw/workspace/.git" ]; then
|
|
|
|
| 412 |
graceful_shutdown() {
|
| 413 |
echo ""
|
| 414 |
echo "🛑 Shutting down gracefully..."
|
| 415 |
+
|
| 416 |
+
if [ -f "/home/node/app/workspace-sync.py" ]; then
|
| 417 |
+
echo "🧠 Snapshotting OpenClaw state before exit..."
|
| 418 |
+
python3 /home/node/app/workspace-sync.py --snapshot-once 2>/dev/null || \
|
| 419 |
+
echo " ⚠️ Could not snapshot OpenClaw state before shutdown"
|
| 420 |
+
fi
|
| 421 |
|
| 422 |
# Commit any unsaved workspace changes
|
| 423 |
if [ -d "/home/node/.openclaw/workspace/.git" ]; then
|
workspace-sync.py
CHANGED
|
@@ -206,6 +206,11 @@ def sync_with_git():
|
|
| 206 |
|
| 207 |
|
| 208 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
if not WORKSPACE.exists():
|
| 210 |
print("📁 Workspace sync: workspace not found, exiting.")
|
| 211 |
return
|
|
|
|
| 206 |
|
| 207 |
|
| 208 |
def main():
|
| 209 |
+
if "--snapshot-once" in sys.argv:
|
| 210 |
+
snapshot_state_into_workspace()
|
| 211 |
+
write_sync_status("configured", "State snapshot refreshed during shutdown.")
|
| 212 |
+
return
|
| 213 |
+
|
| 214 |
if not WORKSPACE.exists():
|
| 215 |
print("📁 Workspace sync: workspace not found, exiting.")
|
| 216 |
return
|