1、通过tomcat的端口号查找pid号,例如Tomcat的端口为:8040,然后通过kill -9
tomcat_pid=lsof -n -P -t -i :8040 kill -9 $tomcat_pid
16687

2、凌晨两点备份 git 文件代码库 find 查找备份7天以前的文件并定时在凌晨3点删除。
0 2 /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
0 3
/bin/find /home/backup -name '_2018_0_10.6.3-ee_gitlab_backup.tar' -mtime +7 |xargs rm -rf

3、shell 常用设定日期
date "+%C%y-%m-%d"

4、nagios服务端检测客户端keepalived脚本

#!/bin/sh
KPD=ps aux | grep 'keepalived -D' |grep -v grep |wc -l
if [ $KPD -ne 3 ]
then
echo "Critical!Keepalived process count is $KPD"
exit 2
fi
echo "OK . Keepalived process count is $KPD"
exit 0

5、sql查询多少条数据
SELECT COUNT(1) FROM 表明