修复备份任务退出码

This commit is contained in:
yml2213
2026-08-17 00:17:42 +08:00
parent 79eebdc8e5
commit 2265c48a53
+6 -4
View File
@@ -35,11 +35,13 @@ run_job() {
write_job_state "${status_dir}" "${type}" success '执行成功' write_job_state "${status_dir}" "${type}" success '执行成功'
"${SCRIPT_DIR}/backup-status.sh" write || true "${SCRIPT_DIR}/backup-status.sh" write || true
return return
else
# 必须在失败分支中立即读取退出码;if 语句本身在无 else 时会返回 0。
local code=$?
write_job_state "${status_dir}" "${type}" failed "执行失败(退出码 ${code}"
"${SCRIPT_DIR}/backup-status.sh" write || true
return "${code}"
fi fi
local code=$?
write_job_state "${status_dir}" "${type}" failed "执行失败(退出码 ${code}"
"${SCRIPT_DIR}/backup-status.sh" write || true
return "${code}"
} }
main() { main() {