mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 23:21:03 -05:00
forgejo-runner.sh reload must wait for the daemon to stop
This commit is contained in:
parent
65714b4555
commit
15a46373fb
1 changed files with 24 additions and 5 deletions
|
@ -32,13 +32,17 @@ function register() {
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
rm -f forgejo-runner.log
|
rm -f forgejo-runner.log
|
||||||
daemon --chdir=$(pwd) --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
daemon --chdir=$(pwd) --unsafe \
|
||||||
|
--env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" \
|
||||||
|
--pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- \
|
||||||
|
forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
||||||
sleep 1
|
sleep 1
|
||||||
cat forgejo-runner.log
|
cat forgejo-runner.log
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
teardown
|
teardown
|
||||||
|
rm -f forgejo-runner.log
|
||||||
run
|
run
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +57,26 @@ function setup() {
|
||||||
run
|
run
|
||||||
}
|
}
|
||||||
|
|
||||||
function teardown() {
|
function stop_daemon() {
|
||||||
if test -f forgejo-runner-pid ; then
|
local daemon=$1
|
||||||
kill -TERM $(cat forgejo-runner-pid)
|
local DIR=.
|
||||||
rm -f forgejo-runner-pid
|
|
||||||
|
if test -f $DIR/$daemon-pid ; then
|
||||||
|
local pid=$(cat $DIR/$daemon-pid)
|
||||||
|
kill -TERM $pid
|
||||||
|
pidwait $pid || true
|
||||||
|
for delay in 1 1 2 2 5 5 ; do
|
||||||
|
if ! test -f $DIR/$daemon-pid ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep $delay
|
||||||
|
done
|
||||||
|
! test -f $DIR/$daemon-pid
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function teardown() {
|
||||||
|
stop_daemon forgejo-runner
|
||||||
|
}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
Loading…
Reference in a new issue