root> ./webserver start // Does not block the terminal after startup, runs in the background and the process is guarded\nroot> \nRun Code Online (Sandbox Code Playgroud)\n\nroot> ./webserver start // Does not block the terminal after startup, runs in the background and the process is guarded\nroot> \nRun Code Online (Sandbox Code Playgroud)\n\n这样rust就会在后台运行,不会阻塞终端,但是rust在后台打印的信息仍然会显示在终端上,退出终端时当前的rust程序也会退出
\n\n进程守护程序逻辑\n\n我的想法是监听系统的退出信号,不处理退出请求
\n\nSIGHUP 1 /* Hangup (POSIX). */ \nSIGINT 2 /* Interrupt (ANSI). */ \nSIGQUIT 3 /* Quit (POSIX). */ \nSIGTERM 15 /* Termination (ANSI). */ \nRun Code Online (Sandbox Code Playgroud)\n\n代码:
\n\n …