1.先编写脚本:
2.添加定时任务
crontab -e
借别人的图说一下cron表达式的写法
查看定时任务是否添加成功
crontab -l
重启cron:
sudo systemctl restart crond.service
注意:
1.需要给定时执行的脚本授予可执行权限。
2.脚本会以root用户执行,保证环境变量不要出问题,可以找到命令。
另附一些jstack的命令:
jstack查看输出
jstack -l 13121
jstack统计线程数
jstack -l 13121 | grep 'java.lang.Thread.State' | wc -l
1.查看cpu占用高进程
top
2.查看cpu占用高线程
top -H -p 13121
3.转换线程ID
printf "%x
" 13121
3341
4.定位cpu占用线程
jstack 13121|grep 3341 -A 30
#!/bin/bash
ad_pid=13121
echo jstack -l $ad_pid