Skip to content

Commit 1cc1448

Browse files
Merge pull request #553 from Martinski4GitHub/dev
Maximum Lock Timeout for AMTM Call
2 parents 71f632d + 0d318c5 commit 1cc1448

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

MerlinAU.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2026-Mar-15
7+
# Last Modified: 2026-Mar-17
88
###################################################################
99
set -u
1010

1111
## Set version for each Production Release ##
1212
readonly SCRIPT_VERSION=1.6.0
13-
readonly SCRIPT_VERSTAG="26031508"
13+
readonly SCRIPT_VERSTAG="26031700"
1414
readonly SCRIPT_NAME="MerlinAU"
1515
## Set to "master" for Production Releases ##
1616
SCRIPT_BRANCH="dev"
@@ -429,6 +429,7 @@ _ReleaseLock_()
429429
}
430430

431431
## Defaults ##
432+
LockSleepDelaySecs=5
432433
LockMaxTimeoutSecs=120
433434
LockFileMaxAgeSecs=600 #10-minutes#
434435

@@ -439,8 +440,9 @@ then
439440
LockFileMaxAgeSecs=1200
440441
else
441442
case "$1" in
442-
run_now|resetLockFile)
443-
LockMaxTimeoutSecs=3
443+
run_now|amtmupdate|resetLockFile)
444+
LockSleepDelaySecs=2
445+
LockMaxTimeoutSecs=1
444446
LockFileMaxAgeSecs=1200
445447
;;
446448
startup|addCronJob)
@@ -457,7 +459,7 @@ _AcquireLock_()
457459
{
458460
local retCode waitTimeoutSecs
459461
local lockFileSecs ageOfLockSecs oldPID
460-
local lockTypeReq lockTypeFound
462+
local lockTypeReq lockTypeFound savedVerbose
461463

462464
if [ $# -gt 0 ] && [ -n "$1" ]
463465
then lockTypeReq="$1"
@@ -474,6 +476,8 @@ _AcquireLock_()
474476
retCode=1
475477
lockTypeFound=""
476478
waitTimeoutSecs=0
479+
savedVerbose="$isVerbose"
480+
isVerbose=true
477481

478482
while true
479483
do
@@ -515,13 +519,15 @@ _AcquireLock_()
515519
then
516520
Say "Lock Found [$lockTypeFound: $ageOfLockSecs secs]. Waiting for script [PID=$oldPID] to exit [Timer: $waitTimeoutSecs secs]"
517521
fi
518-
sleep 5
519-
waitTimeoutSecs="$((waitTimeoutSecs + 5))"
522+
sleep "$LockSleepDelaySecs"
523+
waitTimeoutSecs="$((waitTimeoutSecs + LockSleepDelaySecs))"
520524
else
521525
Say "${REDct}**ERROR**${NOct}: The shell script ${ScriptFileName} [PID=$oldPID] is already running [$lockTypeFound: $ageOfLockSecs secs]"
522526
retCode=1 ; break
523527
fi
524528
done
529+
530+
isVerbose="$savedVerbose"
525531
return "$retCode"
526532
}
527533

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
22

33
## v1.6.0
4-
## 2026-Mar-15
4+
## 2026-Mar-17
55

66
## WebUI:
77
![image](https://github.com/user-attachments/assets/9c1dff99-9c13-491b-a7fa-aff924d5f02e)

0 commit comments

Comments
 (0)