Files
Nexus/scripts/batch_patch_files_sudoers.sh
T
2026-07-08 22:31:31 +08:00

25 lines
813 B
Bash

#!/usr/bin/env bash
# Batch patch nexus-files sudoers on sub-servers (rsync for file push elevation).
#
# Usage:
# bash scripts/batch_patch_files_sudoers.sh --name 温胜夜
# bash scripts/batch_patch_files_sudoers.sh --non-root-only --limit 100
# bash scripts/batch_patch_files_sudoers.sh --ids 12,34 --dry-run
#
# Run on machine with .env (local dev or ssh nexus + cd /opt/nexus).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SECRETS="${ROOT}/deploy/nexus-1panel.secrets.sh"
if [[ -f "$SECRETS" ]]; then
# shellcheck disable=SC1090
source "$SECRETS"
fi
PYTHON="${ROOT}/.venv/bin/python"
if [[ ! -x "$PYTHON" ]]; then
PYTHON="${ROOT}/venv/bin/python"
fi
if [[ ! -x "$PYTHON" ]]; then
PYTHON=python3
fi
exec "$PYTHON" "${ROOT}/scripts/batch_patch_files_sudoers.py" "$@"