欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2022-04-06 08:13:24
先看代码 #/bin/sh datename=$(date +%y%m%d-%h%m%s) echo $datename >> /tmp/logtest.tx...

先看代码

#/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

总结

以上所述是小编给大家介绍的linux 上在指定时间段内每隔多少分钟自动执行任务计划crontab,希望对大家有所帮助