大家好,又见面了,我是你们的朋友全栈君。
minute hour day-of-month month-of-year day-of-week commands 00-59 00-23 01-31 01-12 0-6 (0 is sunday) * 代表所有的取值范围内的数字/ 代表每的意思, /5 表示每5个单位- 代表从某个数字到某个数字, 分开几个离散的数字0 6 * * * echo "Good morning." >> /tmp/test.txt
// 注意单纯echo,从屏幕上看不到任何输出,因为cron把任何输出都email到root的信箱了。0 */2 * * * echo "Have a break now." >> /tmp/test.txt 0 23-7/2,8 * * * echo "Have a good dream" >> /tmp/test.txt0 11 4 * 1-3 command line0 4 1 1 * command line SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root
// 如果出现错误,或者有数据输出,数据作为邮件发给这个帐号 HOME=/ /etc/cron.hourly 内的脚本01 * * * * root run-parts /etc/cron.hourly/etc/cron.daily 内的脚本02 4 * * * root run-parts /etc/cron.daily /etc/cron.weekly 内的脚本22 4 * * 0 root run-parts /etc/cron.weekly /etc/cron.monthly 内的脚本42 4 1 * * root run-parts /etc/cron.monthly
// 注意: "run-parts"这个参数了,如果去掉这个参数的话,后面就可以写要运行的某个脚本名,而不是文件夹名。 5,15,25,35,45,55 16,17,18 * * * command00 15 * * 1,3,5 shutdown -r +5innd/bbslin 这个指令:10,40 * * * * innd/bbslink bin/account 这个指令:1 * * * * bin/account20 3 * * * (/bin/rm -f expire.ls logins.bad;bin/expire >> expire.1st) /bin/rm -f expire.1st 这个指令,并把结果添加在 mm.txt 这个文件之后(mm.txt文件位于用户自己的目录位置):12,55 3 4-9 1,4 * /bin/rm -f expire.1st >> mm.txt 版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/234157.html原文链接:https://javaforall.cn