From 763b810ca1a9d755205e49b1246025b83abb5132 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Wed, 27 Jan 2021 04:41:00 +0000 Subject: Add netbox --- netbox/etc/service/uwsgi/run | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 netbox/etc/service/uwsgi/run (limited to 'netbox/etc/service/uwsgi/run') 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 @@ +#!/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 -- cgit v1.2.3