daemonize forgejo-runner

This commit is contained in:
Earl Warren 2023-03-27 23:30:22 +02:00
parent 03450c69a0
commit 202709a555
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -10,8 +10,8 @@ function dependencies() {
tar zxf go1.20.2.linux-amd64.tar.gz tar zxf go1.20.2.linux-amd64.tar.gz
export PATH=$PATH:$(pwd)/go/bin export PATH=$PATH:$(pwd)/go/bin
fi fi
if ! which make > /dev/null ; then if ! which make daemon > /dev/null ; then
apt-get install -y -qq make apt-get install -y -qq make daemon
fi fi
} }
@ -39,8 +39,7 @@ function register() {
} }
function run() { function run() {
./forgejo-runner/forgejo-runner daemon >& forgejo-runner.log & daemon --chdir=$(pwd) --unsafe --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log ./forgejo-runner/forgejo-runner daemon
echo $! > forgejo-runner-pid
sleep 1 sleep 1
cat forgejo-runner.log cat forgejo-runner.log
} }
@ -59,7 +58,7 @@ function setup() {
function teardown() { function teardown() {
if test -f forgejo-runner-pid ; then if test -f forgejo-runner-pid ; then
kill -9 $(cat forgejo-runner-pid) kill -TERM $(cat forgejo-runner-pid)
rm -f forgejo-runner-pid rm -f forgejo-runner-pid
fi fi
} }