#!/bin/bash # uninstall.sh — Remove the OAuth token sync service set -uo pipefail LOG_PREFIX="[uninstall]" log() { echo "$LOG_PREFIX $*"; } echo "" echo "Removing OAuth Token Sync for OpenClaw" echo "=======================================" echo "" # Stop and disable systemd services for svc in sync-oauth-token.service refresh-claude-token.service refresh-claude-token.timer trigger-claude-refresh.service trigger-claude-refresh.timer; do if systemctl is-active --quiet "$svc" 2>/dev/null; then log "Stopping $svc..." systemctl stop "$svc" fi if systemctl is-enabled --quiet "$svc" 2>/dev/null; then log "Disabling $svc..." systemctl disable "$svc" fi if [ -f "/etc/systemd/system/$svc" ]; then log "Removing /etc/systemd/system/$svc" rm -f "/etc/systemd/system/$svc" fi done systemctl daemon-reload 2>/dev/null # Remove installed scripts for script in /usr/local/bin/sync-oauth-token.sh /usr/local/bin/refresh-claude-token.sh /usr/local/bin/trigger-claude-refresh.sh; do if [ -f "$script" ]; then log "Removing $script" rm -f "$script" fi done echo "" log "Done. The following files were NOT removed (contain your credentials):" log " - /root/.openclaw/credentials/oauth.json" log " - /root/openclaw/.env (ANTHROPIC_OAUTH_TOKEN)" log " - /root/.openclaw/agents/*/agent/auth-profiles.json" echo "" log "To fully clean up, remove those manually if needed."