iai-mcp-opencode/deploy/systemd/iai-mcp-daemon.service
Apunkt 7f01b8824e
fix(systemd): Restart=always so daemon restarts after HIBERNATION clean exit
The daemon exits with status 0 on HIBERNATION (by design, to drop RSS).
Restart=on-failure only restarts on non-zero exits, so the daemon
stayed dead. Change to Restart=always.
2026-05-19 10:32:06 +02:00

42 lines
1.3 KiB
Desktop File

# IAI-MCP Sleep Daemon -- systemd user unit (Plan 04-01, DAEMON-01)
#
# Install at ~/.config/systemd/user/iai-mcp-daemon.service, then:
# systemctl --user daemon-reload
# systemctl --user enable --now iai-mcp-daemon.service
#
# For survival past logout (headless servers):
# loginctl enable-linger $USER
#
# C3 / guard: NO paid-API env var in Environment= lines. host_cli.py
# scrubs the subprocess env at spawn time; the unit env is intentionally minimal.
[Unit]
Description=IAI-MCP Sleep Daemon -- autonomous neural consolidation between sessions
After=default.target
StartLimitIntervalSec=60
StartLimitBurst=3
[Service]
Type=simple
ExecStart=%h/.venv/iai-mcp/bin/python -m iai_mcp.daemon
Restart=always
RestartSec=30
Environment="IAI_MCP_STORE=%h/.iai-mcp"
Environment="QDRANT_URL=http://192.168.0.22:6333"
Environment="QDRANT_API_KEY=1CerixWX$3zdlj"
Environment="IAI_MCP_EMBED_MODEL=bge-m3"
Environment="LANG=en_US.UTF-8"
StandardOutput=journal
StandardError=journal
SyslogIdentifier=iai-mcp-daemon
# Graceful shutdown: systemd default TimeoutStopSec is 90s; we tighten to 60s
# so stop never kills us mid-Claude (subprocess timeout is 120s but the
# daemon aborts the pending call cleanly on SIGTERM).
TimeoutStopSec=60
KillSignal=SIGTERM
[Install]
WantedBy=default.target