Fix Bash syntax error in disable_opcache JPS action - simplify error detection

main
Anthony 2026-02-28 15:20:55 +08:00
parent d126152db6
commit a1c5f07f87
1 changed files with 3 additions and 12 deletions

View File

@ -655,20 +655,11 @@ actions:
commands: commands:
- | - |
set -euo pipefail set -euo pipefail
TMP_OUTPUT="$(mktemp)" OUTPUT=$(php /home/litespeed/mbmanager/scripts/toggle_opcache.php disable 2>&1)
cleanup() { echo "$OUTPUT"
rm -f "${TMP_OUTPUT}" if echo "$OUTPUT" | grep -q '"status".*:.*"error"'; then
}
trap cleanup EXIT
php /home/litespeed/mbmanager/scripts/toggle_opcache.php disable > "${TMP_OUTPUT}"
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"error"' "${TMP_OUTPUT}"; then
cat "${TMP_OUTPUT}"
exit 1 exit 1
fi fi
cat "${TMP_OUTPUT}"
- restartNodes: - restartNodes:
- nodeGroup: "cp" - nodeGroup: "cp"
reboot: true reboot: true