aboutsummaryrefslogtreecommitdiff
path: root/netbox/etc/service/uwsgi/run
blob: e24ede7565f7b95c554cb09889e66720d4ee07dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# runsv sends us a TERM but uwsgi will only shutdown cleanly
# if it receives an INT so we need to translate the signal
# properly for uwsgi
trap 'kill -INT $PID' TERM

/usr/sbin/uwsgi --ini /etc/uwsgi/netbox.ini &

PID=$!

# wait for uwsgi, will get cancelled when runsv TERMs us and
# the trap will get executed next, unless something goes wrong
# and uwsgi fails then this wait will run
wait $PID

# if something went wrong then unregister the trap because it
# won't have a target
trap - TERM

# waiting on a dead process will return the return code of the
# processes original exit
wait $PID