SPB Git

spb/findata

Public
1000 B · 15 lines shellscript
1#!/bin/bash2# macOS TCC workaround (M3U96a): processes started by PM2/launchd have no "Full Disk Access" and block on the3# external SSD (/Volumes/ssd). sshd-keygen-wrapper does have Full Disk Access, so PM2 runs this wrapper, which4# re-executes the real command on localhost through sshd. The ssh client is what PM2 supervises; when it stops,5# the pty hangs up and the worker receives SIGHUP (handled as a graceful stop).6# Usage: run-under-sshd.sh <workdir> <command...>7set -u8WORKDIR="$1"; shift9KEY="$HOME/.ssh/id_ed25519_maclustr"10REMOTE_PATH="/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/bin:$HOME/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin"11CMD=$(printf '%q ' "$@")12exec env -u SSH_AUTH_SOCK ssh -tt -q -o BatchMode=yes -o IdentitiesOnly=yes -i "$KEY" -o StrictHostKeyChecking=accept-new \13  -o ServerAliveInterval=30 -o ServerAliveCountMax=3 localhost \14  "cd $(printf '%q' "$WORKDIR") && export PATH=$REMOTE_PATH FINDATA_ROOT=$(printf '%q' "$WORKDIR") PYTHONUNBUFFERED=1 && exec $CMD"15
Files · cee6fa99e6788021c38bbadb0e5c000678e6d915
Menu

Theme