Linux和MacOs的定时任务的编写
1.crontab指令编辑定时任务文件:crontab -e
SHELL=/bin/sh
PATH=/lv01/apache-jmeter-5.4/bin:/xxx/apache-jmeter-5.4/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
bin:/root/bin:/root/bin:/root/bin
0 */1 * * * /root/app/jmx_info/jmx_cmd.sh
2.查看已有的定时任务:crontal -l //查看定时的列表
3.启动定时任务:
/sbin/service crond restart
macos中:sudo /usr/sbin/cron start