Linux CRONTAB记录
来源:互联网 发布:最新影视软件 编辑:程序博客网 时间:2024/05/01 17:17
crontab -u //指定某个用户的cron服务
crontab -l //列出某个用户的cron服务的详细内容
crontab -r //删除某个用户的cron服务
crontab -e //编辑某个用户的cron服务
2、系统的 cron 任务
cron 守护进程在搜索 /var/spool/cron 目录下用户的 crontab 文件的同时, 还将搜索 /etc/crontab 文件,这个文件是系统安装时设置好的自动安排的进程任务的crontab 文件。这为系统管理员安排 cron 任务提供了方便。CentOS 默认的 /etc/crontab 文件的内容为:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
/etc/cron.daily、/etc/cron.m onthly、/etc/cron.weekly 和 /etc/cron.hourly 是四个目录,分别放置系统每天、每个月、每周和每个小时要执行的任务的脚本文件。
run-parts 命令的作用是运行指定目录下的所有可执行文件(包括程序或脚本)。
crontab 文件中的每一行格式为:
minute hour day-of-month month-of-year day-of-week [username] commands
简化些:
* * * * * [username] commands
其中username(以它的身份执行)是可选的,commands是每次都必须指定的字段。前面的5个日期字段如果不指定可以*号代替。
注:run-parts参数表示,执行后面目录中的所有可执行文件,如果单独执行某个脚本的话,是不需要增加run-parts参数的。]
所以要指定cron的用户执行身份的话,是在/etc/crontab中,而不是用crontab命令。
相关:
/var/spool/cron/ 该目录下存放所有用户的cron服务
/var/log/cron 记录cron运行的日志信息。
- Linux CRONTAB记录
- Linux创建crontab,定时将信息记录写入文件
- linux crontab
- Linux Crontab
- linux crontab
- Linux crontab
- Linux crontab
- 【Linux】 crontab
- linux--crontab
- Linux Crontab
- crontab linux
- linux crontab
- linux crontab
- linux crontab
- crontab Linux
- Linux-crontab
- linux crontab
- Linux crontab
- PHP 第七章
- chrome找不到模拟移动端
- 断言(ASSERT)的用法
- 软键盘的关闭和显示
- window.location.search.substring(1); 什么意思
- Linux CRONTAB记录
- POJ 2299 Ultra-QuickSort【求逆序数:归并排序|树状数组】
- 26个省会城市平均工资 各地收入相同购买力不同
- 疑难杂症
- EXTJS 动态更新的折线图
- Access Violation
- ie6兼容性
- Codeforces Round#260E
- REST服务