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