updater: Fix error "XHR request timed out"

This commit is contained in:
remittor
2026-01-31 16:49:08 +03:00
parent 60044abbc0
commit 07f5b13f11
2 changed files with 41 additions and 21 deletions

View File

@@ -1,15 +1,22 @@
#!/bin/sh
# Copyright (c) 2024 remittor
PID_FILE=/tmp/zapret-script-exec.pid
[ -f $PID_FILE ] && exit 70
LOG_FILE=$1
RC_FILE=$1.rc
shift 1
SH_FILE=$2
shift 2
[ ! -f $SH_FILE ] && exit 71
: > $LOG_FILE
: > $RC_FILE
(
exec </dev/null >/dev/null 2>&1
"$@" >> $LOG_FILE 2>&1
RETCODE=$?
start-stop-daemon -S -b -p $PID_FILE -x /bin/sh -- -c '
LOG_FILE=$1
RC_FILE=$2
SH_FILE=$3
shift 3
sh $SH_FILE "$@" > $LOG_FILE 2>&1
RET_CODE=$?
sleep 1
echo $RETCODE > $RC_FILE
) &
echo $RET_CODE > $RC_FILE
' sh $LOG_FILE $RC_FILE $SH_FILE "$@"
exit 0