aboutsummaryrefslogtreecommitdiff
path: root/netbox/etc/service/uwsgi/run
diff options
context:
space:
mode:
Diffstat (limited to 'netbox/etc/service/uwsgi/run')
-rwxr-xr-xnetbox/etc/service/uwsgi/run23
1 files changed, 23 insertions, 0 deletions
diff --git a/netbox/etc/service/uwsgi/run b/netbox/etc/service/uwsgi/run
new file mode 100755
index 0000000..e24ede7
--- /dev/null
+++ b/netbox/etc/service/uwsgi/run
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3# runsv sends us a TERM but uwsgi will only shutdown cleanly
4# if it receives an INT so we need to translate the signal
5# properly for uwsgi
6trap 'kill -INT $PID' TERM
7
8/usr/sbin/uwsgi --ini /etc/uwsgi/netbox.ini &
9
10PID=$!
11
12# wait for uwsgi, will get cancelled when runsv TERMs us and
13# the trap will get executed next, unless something goes wrong
14# and uwsgi fails then this wait will run
15wait $PID
16
17# if something went wrong then unregister the trap because it
18# won't have a target
19trap - TERM
20
21# waiting on a dead process will return the return code of the
22# processes original exit
23wait $PID