Hook up SIGINT/SIGTERM to attempt a clean shutdown.