implement the signal so that when the server received SIGTERM or SIGINT, it can shutdown gracefully