updater: Added retcode file (pid-file deleted)

This commit is contained in:
remittor
2025-12-18 10:46:29 +03:00
parent 06f45e3fbb
commit a616c6fa4e
3 changed files with 44 additions and 62 deletions

View File

@@ -1,16 +1,15 @@
#!/bin/sh
# Copyright (c) 2024 remittor
PID_FILE=/tmp/$1.pid
LOG_FILE=/tmp/$1.log
ERR_FILE=/tmp/$1.err
LOG_FILE=$1
RC_FILE=$1.rc
shift 1
: > $LOG_FILE
: > $ERR_FILE
: > $RC_FILE
(
exec </dev/null >/dev/null 2>&1
"$@" >> $LOG_FILE 2>&1
echo $? > "$ERR_FILE"
RETCODE=$?
sleep 1
echo $RETCODE > $RC_FILE
) &
echo $! > $PID_FILE
exit 0

View File

@@ -11,26 +11,26 @@ opt_update=
opt_forced=
opt_test=
while getopts "cu:pft" opt; do
while getopts "cu:pft:" opt; do
case $opt in
c) opt_check=true;;
p) opt_prerelease=true;;
u) opt_update="$OPTARG";;
f) opt_forced=true;;
t) opt_test=true;;
t) opt_test="$OPTARG";;
esac
done
ZAP_PKG_DIR=/tmp/zapret_pkg
if [ "$opt_test" = "true" ]; then
if [ "$opt_test" != "" ]; then
echo 1; sleep 2;
echo 2; sleep 2;
echo 3; sleep 2;
echo ' * resolve_conffiles 123456'; sleep 1;
echo 4; sleep 2;
echo END
return 0;
return "$opt_test"
fi
ZAP_CPU_ARCH=$(get_cpu_arch)