add traps and auto rebuild on a schedule

master
Dirk Heilig 2024-01-19 11:06:49 +01:00
parent cf5ee0cebc
commit d57c0fa00c
1 changed files with 13 additions and 0 deletions

13
starter
View File

@ -1,8 +1,13 @@
#!/usr/bin/env bash
set -e
nginx -t
nginx -g 'daemon off;' &
nginx_pid=$!
trap 'kill "$nginx_pid"' EXIT
trap 'kill "$nginx_pid"' SIGTERM
function checkIsUpToDate() {
git fetch
git rev-list HEAD...origin/master --count | grep -q "^0$" && {
@ -32,4 +37,12 @@ update
) &
(
while true; do
sleep 1h
update
done
) &
wait "$nginx_pid"