add traps and auto rebuild on a schedule
parent
cf5ee0cebc
commit
d57c0fa00c
13
starter
13
starter
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue