Read varaverk.cfg the way bash and the PHP side both read it, so a comment on the SCRIPTS_DIR line cannot disable cron suppression
This commit is contained in:
@@ -103,7 +103,19 @@ if [[ "$MANUAL" == false && -f "$MANUAL_TS_FILE" ]]; then
|
|||||||
# Static schedules like "30 2 * * 0" run at their appointed time and are never suppressed.
|
# Static schedules like "30 2 * * 0" run at their appointed time and are never suppressed.
|
||||||
INTERVAL=0
|
INTERVAL=0
|
||||||
_VV_CFG="/boot/config/plugins/varaverk/varaverk.cfg"
|
_VV_CFG="/boot/config/plugins/varaverk/varaverk.cfg"
|
||||||
_SCRIPTS_DIR=$(grep -m1 '^SCRIPTS_DIR' "$_VV_CFG" 2>/dev/null | cut -d= -f2 | tr -d '"'"'" | tr -d '[:space:]')
|
# Sourced in a subshell rather than grep|cut|tr. varaverk.cfg is shell syntax, so this is
|
||||||
|
# how bash itself reads it, and it agrees with the PHP side — include/config.php uses
|
||||||
|
# parse_ini_file(), which already honours quoting and comments.
|
||||||
|
#
|
||||||
|
# The pattern this replaces was `cut -d= -f2 | tr -d '[:space:]'`, which keeps everything
|
||||||
|
# after the first `=` and then squeezes all whitespace out of it. One trailing comment on
|
||||||
|
# that line — SCRIPTS_DIR="/mnt/user/appdata/Varaverk" # appdata mode — and the value
|
||||||
|
# becomes a path with the comment welded onto it, schedule.json is never found, INTERVAL
|
||||||
|
# stays 0, and every manual run silently stops suppressing the next cron fire. It also
|
||||||
|
# matched a bare `^SCRIPTS_DIR` prefix, so a future SCRIPTS_DIRECTORY= would win the -m1.
|
||||||
|
#
|
||||||
|
# Subshell so nothing else the cfg defines leaks into this runner or the job it wraps.
|
||||||
|
_SCRIPTS_DIR=$( . "$_VV_CFG" >/dev/null 2>&1 || true; printf '%s' "${SCRIPTS_DIR:-}" )
|
||||||
SCHEDULE_FILE="${_SCRIPTS_DIR:-/boot/config/plugins/varaverk}/schedule.json"
|
SCHEDULE_FILE="${_SCRIPTS_DIR:-/boot/config/plugins/varaverk}/schedule.json"
|
||||||
if [[ -f "$SCHEDULE_FILE" ]]; then
|
if [[ -f "$SCHEDULE_FILE" ]]; then
|
||||||
CRON_EXPR=$(php -r "
|
CRON_EXPR=$(php -r "
|
||||||
|
|||||||
Reference in New Issue
Block a user