systemd查看日志文件有隐藏该如何处理
1、systemctl status SERVICE -l
-l选项显示完整选项
2、journalctl -u SERVICE
使用journalct命令查看
自己动手写一个systemd的配置文件,让Nginx服务可以开机启动
[root@www ~]# vim /lib/systemd/system/nginx-test.service
[Unit]
Description=Test Service
[Service]
Type=forking
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
[root@www ~]# systemctl enable nginx-test
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx-test.service to /usr/lib/systemd/system/nginx-test.service.
SIGHUP SIGQUIT SIGTERM SIGINTERRUPT的区别
1、SIGHUP: 无需关闭进程而让其重读配置
2、SIGQUIT: 终止进程,由QUIT字符(通常是Ctrl-)来控制,进程在因收到SIGQUIT退出时会产生core文件
3、SIGTERM: 程序结束(terminate)信号,该信号可以被阻塞和处理。通常用来要求程序自己正常退出
4、SIGNTERRUPT: 允许信号中断系统调用
用awk查看tcp链接处于TIMEOUT的连接个数`
netstat -tan|awk '/TIMEOUT/{state[$NF]}END{for(i in state) {print i,state[i]}'