SPB Git

Repository Public

dev-down.sh 1.2 KB 28 lines shellscript

1#!/bin/zsh2# Stops the processes started by scripts/dev-up.sh and kills ONLY the dev tmux server3# (socket `claude-remote-dev`): terminal sessions and tasks of the dev instance end here.4# The database claude_remote_dev and /tmp/cr-dev-* are kept (remove them by hand for a fresh start).5set -uo pipefail6[[ -d /tmp/cr-dev-data ]] || { echo "nothing to stop (no /tmp/cr-dev-data)"; exit 0; }7DATA="$(cd /tmp/cr-dev-data && pwd -P)"8TMUX_SOCKET=claude-remote-dev910stop() {11  local name="$1" file="$DATA/run/$1.pid" pid12  [[ -f "$file" ]] || { echo "$name: not running"; return; }13  pid="$(cat "$file")"14  # Only signal a process that is really ours (a node process of this repository's dist/).15  if kill -0 "$pid" 2>/dev/null && ps -o command= -p "$pid" | grep -q "apps/$name/dist/main.js"; then16    kill -TERM "$pid" 2>/dev/null17    for i in {1..100}; do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done18    if kill -0 "$pid" 2>/dev/null; then kill -KILL "$pid" 2>/dev/null; fi19    echo "$name: stopped"20  else21    echo "$name: not running"22  fi23  rm -f "$file"24}25stop server26stop runtime27if tmux -L "$TMUX_SOCKET" kill-server 2>/dev/null; then echo "tmux ($TMUX_SOCKET): server killed"; else echo "tmux ($TMUX_SOCKET): no server"; fi28
Files main
Menu

Theme