Added graceful shutdown on SIGHUP

sys and traceback are unused