mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-07-04 13:43:37 +02:00
fix: reduce phone penalty to 100s, fix shutdown guard race condition
- PHONE_PENALTY_DELAY_PRODUCTION: 600 → 100 seconds - adjust_shutdown_schedule.sh: write canonical copy before watched config to prevent shutdown-schedule-guard.path from restoring stale values
This commit is contained in:
parent
bb5c43400f
commit
13d64d98eb
@ -6,7 +6,7 @@ from pathlib import Path
|
||||
|
||||
SICK_LOCKOUT_SECONDS = 120 # 2 minutes wait when sick
|
||||
PHONE_PENALTY_DELAY_DEMO = 10
|
||||
PHONE_PENALTY_DELAY_PRODUCTION = 600
|
||||
PHONE_PENALTY_DELAY_PRODUCTION = 100
|
||||
ADB_TIMEOUT = 15
|
||||
STRONGLIFTS_DB_REMOTE = (
|
||||
"/data/data/com.stronglifts.app/databases/StrongLifts-Database-3"
|
||||
|
||||
@ -72,16 +72,16 @@ MORNING_END_HOUR=$3
|
||||
chattr -i "$CONFIG_FILE" 2>/dev/null || true
|
||||
chattr -i "$CANONICAL_FILE" 2>/dev/null || true
|
||||
|
||||
# Write new config
|
||||
echo "$NEW_CONFIG" > "$CONFIG_FILE"
|
||||
# Write canonical copy FIRST (before the watched config) to avoid
|
||||
# a race with shutdown-schedule-guard.path which triggers on CONFIG_FILE
|
||||
# changes and restores from CANONICAL_FILE.
|
||||
echo "$NEW_CONFIG" > "$CANONICAL_FILE"
|
||||
|
||||
# Set permissions
|
||||
chmod 644 "$CONFIG_FILE"
|
||||
chmod 644 "$CANONICAL_FILE"
|
||||
|
||||
# Re-apply immutable attributes
|
||||
chattr +i "$CONFIG_FILE" || echo "Warning: Could not set immutable on $CONFIG_FILE" >&2
|
||||
chattr +i "$CANONICAL_FILE" || echo "Warning: Could not set immutable on $CANONICAL_FILE" >&2
|
||||
|
||||
# Now write the watched config — guard will see content matches canonical
|
||||
echo "$NEW_CONFIG" > "$CONFIG_FILE"
|
||||
chmod 644 "$CONFIG_FILE"
|
||||
chattr +i "$CONFIG_FILE" || echo "Warning: Could not set immutable on $CONFIG_FILE" >&2
|
||||
|
||||
echo "Shutdown schedule updated: Mon-Wed=${1}:00, Thu-Sun=${2}:00, Morning end=${3}:00"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user