12.crontab
来源:互联网 发布:开淘宝店做代销赚钱吗 编辑:程序博客网 时间:2024/06/04 18:54
cat /etc/crontab
S
SHELL=/bin/bash
P
PATH=/sbin:/bin:/usr/sbin:/usr/bin
M
MAILTO=root
H
HOME=/
#
For details see man 4 crontabs
#
Example of job definition:
#
.—————- minute (0 - 59)
#
| .————- hour (0 - 23)
#
| | .———- day of month (1 - 31)
#
| | | .——- month (1 - 12) OR jan,feb,mar,apr …
#
| | | | .—- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
#
| | | | |
#
* * * * * user-name command to be executed
/etc/cron.deny 表示不能使用crontab 命令的用户
/etc/cron.allow 表示能使用crontab的用户。
如果两个文件同时存在,那么/etc/cron.allow 优先。
如果两个文件都不存在,那么只有root用户可以安排作业。
crontab命令中的一些常用特殊符号:
符号
说明
*
表示任何时刻
,
表示分割
-
表示一个段,如第二段里: 1-5,就表示1到5点
/n
表示每个n的单位执行一次,如第二段里,*/1, 就表示每隔1个小时执行一次命令。也可以写成1-23/1.
0 /1 * * 毎时0分 每隔1小时 执行
2 8-20/3 * * * 8:02,11:02,14:02,17:02,20:02 执行
* * * * * 每分钟执行一次
at(atd): 仅运行一次
crontab(crond): 可循环运行
/etc/init.d/atd restart
chkconfig atd on
at:
1)先搜寻at.allow,只有该文件中存在的用户才可以运行at
2)at.allow不存在,搜寻at.deny,只有该文件中的用户不能使用at
3)两个文件都不存在,只有root能够使用at
at now + 5 minutes
warning: commands will be executed using /bin/sh
at> /bin/mail root -s “testing at job” < /root/.bashrc
at>
at 23:00 2009-03-17
at> /bin/sync
at> /bin/sync
at> /sbin/shutdown -h now
atq
at -c 9
atrm 9
batch executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified in the invocation of atrun
=====================================
crontab:
1)先搜寻cron.allow,只有该文件中存在的用户才可以运行crontab
2)cron.allow不存在,搜寻cron.deny,只有该文件中的用户不能使用crontab
3)两个文件都不存在,只有root能够使用crontab
- 12.crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- crontab
- Crontab
- crontab
- crontab
- crontab
- Crontab
- Crontab
- java设计模式之静态代理
- 重新配置android开发环境(由32位到64位)
- Alcatraz插件管理工具比如安装KSImageNamed
- (蓝桥杯)历届试题 小朋友排队(树状数组求逆序对)
- 11.特殊设备
- 12.crontab
- 设计模式之责任链模式(ChainOfResponsibility)&正反顺逆链处理
- 嵌入式(mini STM32f103RB)程序下载问题
- 前端开发知识架构
- 驱动程序一:基于STM32自码 DS18B20驱动程序
- python 将 csv(中文) 导入mysql 数据库的简单代码
- 13.PAM
- freemarker生成HTML页面时,遇到乱码的解决办法
- HOG+SVM vc6.0 + openCv配置