fix(deploy): git pull 后备份脚本不依赖可执行位
db_backup/backup_mysql 改为检测文件存在并用 bash 调用;install_ops_cron 一并 chmod 备份脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+2
-1
@@ -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)"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user