- 通用的服务启动模板
- 使用信号实现优雅的退出程序,以达到服务终止前清理资源
- c++
- cmake
git clone https://github.com/BAMSHK/signal-handle-demo.git
cd signal-handle-demo
mkdir build
cd build
cmake ..
make
PID的值在程序的输出中查看 例如 kill -s SIGINT 1111
kill -s SIGINT {PID}
或者
kill -s SIGUSR1 {PID}
git clone https://github.com/BAMSHK/signal-handle-demo.git
cd signal-handle-demo
mkdir build
cd build
cmake ..
make
PID的值在程序的输出中查看 例如 kill -s SIGINT 1111
kill -s SIGINT {PID}
或者
kill -s SIGUSR1 {PID}