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 #!/usr/bin/env bash
set -e set -e
nginx -t nginx -t
nginx -g 'daemon off;' & nginx -g 'daemon off;' &
nginx_pid=$! nginx_pid=$!
trap 'kill "$nginx_pid"' EXIT
trap 'kill "$nginx_pid"' SIGTERM
function checkIsUpToDate() { function checkIsUpToDate() {
git fetch git fetch
git rev-list HEAD...origin/master --count | grep -q "^0$" && { 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" wait "$nginx_pid"