当前位置:主页 > 服务器 > Linux >

linux 上在指定时间段内每隔多少分钟自动执行任务计划crontab

时间:2021-02-05 09:27:30 | 栏目:Linux | 点击:

先看代码

#/bin/sh
datename=$(date +%Y%m%d-%H%M%S)
echo $datename >> /tmp/logtest.txt
*/2 19,20 * * * /bin/sh /root/1.sh

在每天晚上2点到19和20点每2分钟执行一次

[root@dpm ~]# cat /tmp/logtest.txt
20191112-180001
20191112-180201
20191112-180401
20191112-180601
20191112-180801
20191112-181001
20191112-181201
20191112-181401
20191112-181601
20191112-181801
20191112-182001
20191112-182201
20191112-182401
20191112-182601
20191112-182801
20191112-183001
20191112-183201
20191112-183401
20191112-183601
20191112-183801
20191112-184002
20191112-184201
20191112-184401
20191112-184601
20191112-184801
20191112-185001
20191112-185201
20191112-185401
20191112-185601
20191112-185801
20191112-190001
20191112-190201
20191112-190401
20191112-190601
20191112-190801
20191112-191001
20191112-191201
20191112-191401
20191112-191601
20191112-191801
20191112-192001
20191112-192201
20191112-192401
20191112-192601
20191112-192802
20191112-193001
20191112-193201
20191112-193401
20191112-193601
20191112-193801
20191112-194001
20191112-194201
20191112-194401
20191112-194601
20191112-194801
20191112-195001
20191112-195201
20191112-195401
20191112-195601
20191112-195801

总结

您可能感兴趣的文章:

相关文章