mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 21:30:55 -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() {
|
||||
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
|
||||
cat forgejo-runner.log
|
||||
}
|
||||
|
||||
function reload() {
|
||||
teardown
|
||||
rm -f forgejo-runner.log
|
||||
run
|
||||
}
|
||||
|
||||
|
@ -53,11 +57,26 @@ function setup() {
|
|||
run
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
if test -f forgejo-runner-pid ; then
|
||||
kill -TERM $(cat forgejo-runner-pid)
|
||||
rm -f forgejo-runner-pid
|
||||
function stop_daemon() {
|
||||
local daemon=$1
|
||||
local DIR=.
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
stop_daemon forgejo-runner
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
|
Loading…
Reference in a new issue