#!/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