summaryrefslogtreecommitdiff
path: root/scripts/claude-daemon-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/claude-daemon-setup.sh')
-rw-r--r--scripts/claude-daemon-setup.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/claude-daemon-setup.sh b/scripts/claude-daemon-setup.sh
new file mode 100644
index 0000000..35f5416
--- /dev/null
+++ b/scripts/claude-daemon-setup.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Set up Claude Code remote-control daemons for each app repo (run as root on Hetzner VPS).
+set -e
+
+# Install Claude Code if not present
+if ! command -v claude &>/dev/null; then
+ npm install -g @anthropic-ai/claude-code
+fi
+
+declare -A REPOS=(
+ ["infra"]="/app/infra"
+ ["tokyo"]="/app"
+ ["whoisband"]="/app/whois-band"
+)
+
+for NAME in "${!REPOS[@]}"; do
+ DIR="${REPOS[$NAME]}"
+ SERVICE="claude-${NAME}.service"
+
+ cat > "/etc/systemd/system/${SERVICE}" << EOF
+[Unit]
+Description=Claude Code Remote Session - ${NAME}
+After=network.target
+
+[Service]
+Type=simple
+User=root
+WorkingDirectory=${DIR}
+ExecStart=/usr/bin/env claude remote-control --name "${NAME}" --spawn worktree
+Restart=always
+RestartSec=15
+StandardOutput=journal
+StandardError=journal
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+ systemctl daemon-reload
+ systemctl enable "${SERVICE}"
+ systemctl restart "${SERVICE}"
+ echo "Started: ${SERVICE} (WorkingDirectory: ${DIR})"
+done
+
+echo ""
+echo "All Claude Code daemons running. Connect via https://claude.ai/code"
+echo ""
+echo "Useful commands:"
+echo " systemctl status claude-infra"
+echo " systemctl status claude-tokyo"
+echo " systemctl status claude-whoisband"
+echo " journalctl -u claude-tokyo -f"