#!/bin/bash # Run ON the node: installs the daily backup launchd agent. set -euo pipefail APP_DIR="${1:-$HOME/apps/spinza}" PLIST="$HOME/Library/LaunchAgents/dev.spinza.backup.plist" mkdir -p "$HOME/Library/LaunchAgents" "$HOME/backups/spinza" chmod +x "$APP_DIR/deploy/backup.sh" cat >"$PLIST" < Labeldev.spinza.backup ProgramArguments/bin/bash$APP_DIR/deploy/backup.sh StartCalendarIntervalHour3Minute40 StandardOutPath$HOME/backups/spinza/launchd.log StandardErrorPath$HOME/backups/spinza/launchd.err EnvironmentVariablesPATH/opt/homebrew/bin:/usr/bin:/bin EOF launchctl bootout "gui/$(id -u)/dev.spinza.backup" 2>/dev/null || true launchctl bootstrap "gui/$(id -u)" "$PLIST" echo "installed dev.spinza.backup (daily 03:40) → $HOME/backups/spinza"