linux 6.x crontab 定时任务使用
2017-03-08 00:00
176 查看
安装crontab:
服务操作说明:
-e:编辑某个用户的crontab文件内容。如果不指定用户,则表示编辑当前用户的crontab文件。
-l:显示某个用户的crontab文件内容,如果不指定用户,则表示显示当前用户的crontab文件内容
常见示例
每天7:50以root 身份执行/etc/cron.daily目录中的所有可执行文件
yum install crontabs
服务操作说明:
/sbin/service crond start //启动服务 /sbin/service crond stop //关闭服务 /sbin/service crond restart //重启服务 /sbin/service crond reload //重新载入配置 /sbin/service crond status //启动服务
# 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
-e:编辑某个用户的crontab文件内容。如果不指定用户,则表示编辑当前用户的crontab文件。
[etl@mdw root]$ crontab -e
-l:显示某个用户的crontab文件内容,如果不指定用户,则表示显示当前用户的crontab文件内容
[etl@mdw root]$ crontab -l #0 2 * * * /bin/sh /home/etl/kettle/bin/day.sh #0 * * * * /bin/sh /home/etl/kettle/bin/hour.sh [etl@mdw root]$
常见示例
每天7:50以root 身份执行/etc/cron.daily目录中的所有可执行文件
50 7 * * * root run-parts /etc/cron.daily [ 注:run-parts参数表示,执行后面目录中的所有可执行文件。]
crontab文件的一些例子: 30 21 * * * /usr/local/etc/rc.d/lighttpd restart 上面的例子表示每晚的21:30重启apache。 45 4 1,10,22 * * /usr/local/etc/rc.d/lighttpd restart 上面的例子表示每月1、10、22日的4 : 45重启apache。 10 1 * * 6,0 /usr/local/etc/rc.d/lighttpd restart 上面的例子表示每周六、周日的1 : 10重启apache。 0,30 18-23 * * * /usr/local/etc/rc.d/lighttpd restart 上面的例子表示在每天18 : 00至23 : 00之间每隔30分钟重启apache。 0 23 * * 6 /usr/local/etc/rc.d/lighttpd restart 上面的例子表示每星期六的11 : 00 pm重启apache。 0 */1 * * * /usr/local/etc/rc.d/lighttpd restart 每一小时重启apache 0 23-7/1 * * * /usr/local/etc/rc.d/lighttpd restart 晚上11点到早上7点之间,每隔一小时重启apache 0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart 每月的4号与每周一到周三的11点重启apache 0 4 1 jan * /usr/local/etc/rc.d/lighttpd restart 一月一号的4点重启apache
相关文章推荐
- linux 定时任务——crontab 的配置和使用
- Linux Crontab 定时任务使用总结
- 使用linux crontab做jar程序定时调度任务
- linux 定时任务介绍,crontab的使用
- linux使用crontab实现PHP执行定时任务及codeiginter参数传递相关
- Linux下使用crontab来执行定时任务计划
- 使用crontab命令配置Linux的系统定时任务
- linux使用crontab实现PHP执行定时任务
- 使用crontab创建 linux 系统定时任务#
- Linux下定时任务Crontab的使用
- linux 定时任务命令 crontab 使用
- Linux 定时任务crontab使用
- linux使用crontab实现PHP执行计划定时任务
- Linux下使用crontab来执行定时任务计划----执行每晚12点多执行移动log日志文件操作
- linux使用crontab实现PHP执行定时任务
- linux使用crontab实现PHP执行计划定时任务
- linux中定时执行任务crond及crontab命令的使用
- crontab使用--linux下的定时任务程序
- CentOS Linux使用crontab运行定时任务的简单示例
- CentOS和Linux使用crontab运行定时任务