diff --git a/deploy/db_backup.sh b/deploy/db_backup.sh index b9a00351..7edbcd9c 100644 --- a/deploy/db_backup.sh +++ b/deploy/db_backup.sh @@ -12,10 +12,11 @@ BACKUP_DIR="${NEXUS_BACKUP_DIR:-/var/backups/nexus}" RETENTION_DAYS="${NEXUS_BACKUP_RETENTION_DAYS:-30}" DUMP_SH="${SCRIPT_DIR}/mysql_dump_to_file.sh" -if [[ ! -x "$DUMP_SH" ]]; then +if [[ ! -f "$DUMP_SH" ]]; then echo "[$(date)] ERROR: missing $DUMP_SH" exit 1 fi +chmod +x "$DUMP_SH" 2>/dev/null || true mkdir -p "$BACKUP_DIR" TIMESTAMP="$(date +%Y%m%d_%H%M%S)" diff --git a/deploy/install_ops_cron.sh b/deploy/install_ops_cron.sh index 8246d482..325995fc 100644 --- a/deploy/install_ops_cron.sh +++ b/deploy/install_ops_cron.sh @@ -49,7 +49,11 @@ ensure_crontab() { ensure_crontab -for f in "${DEPLOY_DIR}/health_monitor.sh" "${DEPLOY_DIR}/db_backup.sh"; do +for f in \ + "${DEPLOY_DIR}/health_monitor.sh" \ + "${DEPLOY_DIR}/db_backup.sh" \ + "${DEPLOY_DIR}/mysql_dump_to_file.sh" \ + ; do if [[ ! -f "$f" ]]; then error "缺少脚本: $f" exit 1 diff --git a/deploy/nexus-1panel.sh b/deploy/nexus-1panel.sh index d56d3f6e..ac733890 100755 --- a/deploy/nexus-1panel.sh +++ b/deploy/nexus-1panel.sh @@ -1057,7 +1057,7 @@ backup_mysql() { return 0 fi dump_sh="${root}/deploy/mysql_dump_to_file.sh" - if [[ ! -x "$dump_sh" ]]; then + if [[ ! -f "$dump_sh" ]]; then warn "缺少 $dump_sh,跳过 MySQL 备份" return 0 fi