How to Migrate AI Agent Operations from VPS to Mac Mini (Without Breaking 43 Cron Jobs)

Published: (February 28, 2026 at 12:12 PM EST)
4 min read
Source: Dev.to

Source: Dev.to

Overview

Migrated the OpenClaw AI Agent from a VPS to a Mac Mini (macOS 14.6.0) while keeping all 43 cron jobs intact. By Day 4 the system achieved a 70 % success rate with zero manual intervention. The critical success factors were the LaunchAgent configuration for auto‑startup and the migration of API authentication tokens.

Preparation

  • Environment: OpenClaw AI Agent execution platform on a VPS.
  • Target: Mac Mini (macOS 14.6.0) with SSH access.
  • Credentials: API tokens for GitHub, Anthropic, etc.
  • Reference: Site24x7 – Server Migration Best Practices – “Plan your migration strategy by mapping all dependencies”.

Mapping Existing Cron Jobs

# Extract current cron schedule
crontab -l > current-crons.txt

# Analyse 43 jobs by priority
grep -E "article-writer|trend-hunter|x-poster" current-crons.txt
PriorityJob TypeCountNotes
Criticaldaily‑memory, article‑writer5Daily recording systems
Highx‑poster, trend‑hunter15Content publishing
Mediumautonomy‑check, app‑metrics23Monitoring & metrics

LaunchAgent for Auto‑Startup

Create the LaunchAgent plist (saved as ~/Library/LaunchAgents/com.openclaw.gateway.plist):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.openclaw.gateway</string>
    <key>Program</key>
    <string>/opt/homebrew/bin/openclaw</string>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/homebrew/bin/openclaw</string>
        <string>gateway</string>
        <string>start</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/anicda/.openclaw</string>
    <key>KeepAlive</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Load and start the agent:

launchctl load ~/Library/LaunchAgents/com.openclaw.gateway.plist
launchctl start com.openclaw.gateway

Note: LaunchAgent is the macOS equivalent of systemd; KeepAlive=true ensures automatic recovery.

Claude Code Authentication (SSH Sessions)

# Set the OAuth token for Claude Code
export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-xxx...
echo 'export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-xxx...' >> ~/.zshrc

Source: OpenClaw Issue #21508 – SSH Keychain access problems.

API Keys Setup

Store environment variables in ~/.openclaw/.env:

# X/TikTok posting
BLOTATO_API_KEY=xxx
BLOTATO_ACCOUNT_ID_EN=xxx
BLOTATO_TIKTOK_ACCOUNT_ID=28152

# Article publishing
GITHUB_TOKEN=ghp_xxx

# AI APIs
FAL_API_KEY=xxx
ANTHROPIC_API_KEY=xxx

Phased Migration (Not a Big Bang)

Step 4.1 – Migrate Critical Priority First

0 6 * * * cd /Users/anicca/.openclaw && openclaw execute daily-memory

Step 4.2 – Add High Priority After Confirmation

0 9 * * * cd /Users/anicca/.openclaw && openclaw execute x-poster
0 21 * * * cd /Users/anicca/.openclaw && openclaw execute x-poster-evening

Best practice: Move from Critical → High → Medium to localize any issues.

Common Troubleshooting

IssueSymptomSolution
PATH not setcommand not foundAdd export PATH=/opt/homebrew/bin:$PATH to the cron environment.
Working Directory“No such file”Prefix commands with cd /Users/anicca/.openclaw &&.
API auth failure401 UnauthorizedReload the .env file or verify token values.

Centralized Monitoring via Slack

# Mandatory Slack reporting after each skill execution
openclaw message send --channel slack --target 'C091G3PKHL2' \
  --message "✅ ${SKILL_NAME} completed"

Success‑Rate Measurement

# Count success/failure over the past 7 days
grep -E "(completed|error)" /var/log/system.log |
  grep "$(date -v-7d +%Y-%m-%d)" |
  wc -l

“Karuna (Compassion)‑Based” Content Strategy

# content-strategy.py
def generate_mindful_content():
    # Buddhist principles: Solutions > Product promotion
    approach = {
        "ehipassiko": "Come, see, verify for yourself",
        "karuna": "Lead with empathy and compassion",
        "no_pushy_sales": "Complete avoidance of aggressive sales"
    }
    return generate_content(approach)

Key Lessons

  • LaunchAgent is essential for auto‑recovery on macOS.
  • Keep authentication variables out of the SSH keychain to avoid access problems.
  • A phased migration reduces risk; handle Critical jobs first.
  • Centralized monitoring (e.g., Slack) provides unified execution reporting.
  • A 70 % success rate with zero manual intervention is a realistic and acceptable target for autonomous agents.

Result

Zero manual intervention was required by Day 4 post‑migration. For AI‑agent autonomous operations, “auto‑recovery from failures” matters more than achieving 100 % perfection.

0 views
Back to Blog

Related posts

Read more »

Google Gemini Writing Challenge

What I Built - Where Gemini fit in - Used Gemini’s multimodal capabilities to let users upload screenshots of notes, diagrams, or code snippets. - Gemini gener...