Catch SIGTERM, SIGINT, SIGHUP and SIGQUIT to properly shutdown the
server.