mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 01:44:16 +08:00
💐 Sync 2026-09-30 01:19:34
This commit is contained in:
1 parent
67427d9030
commit
a64d55f7c5
50 files changed
+2837
-589
No files matched your search
@@ -17,8 +17,10 @@ for c in lua5.1 lua; do
|
||||
done
|
||||
|
||||
if [ -z "$LUA_BIN" ]; then
|
||||
# 没有解释器 = 整个订阅更新链路不可用,属于必须暴露的故障,
|
||||
# 不能静默 exit 0 让 cron 看起来一切正常。
|
||||
logger -t luci-app-substore "cron: no lua interpreter found"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -f "$LIST_FILE" ] || exit 0
|
||||
@@ -61,4 +63,12 @@ printf '%s\n' "$OUT"
|
||||
if command -v logger >/dev/null 2>&1; then
|
||||
printf '%s\n' "$OUT" | logger -t luci-app-substore
|
||||
fi
|
||||
exit 0
|
||||
|
||||
# 退出码反映本轮结果:有订阅更新失败就返回非 0,让 cron 的 MAILTO / 外部监控
|
||||
# 能据此判断,而不是无论成败都 exit 0。日志行由上面 Lua 以 %d 格式打印,
|
||||
# 不存在前导零,故可直接按字面比较。
|
||||
FAILED=$(printf '%s\n' "$OUT" | sed -n 's/.*: [0-9][0-9]* ok, \([0-9][0-9]*\) failed.*/\1/p' | tail -1)
|
||||
case "$FAILED" in
|
||||
''|0) exit 0 ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
Reference in new issue
Block a user