码迷,mamicode.com
首页 > 系统相关 > 详细

linux-计划任务

时间:2018-07-28 18:23:04      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:let   file   list   etc   rom   计划任务   需要   boot   名称   

计划任务

环境:ubuntu-16.04.4-server-amd64

crontab [-u user] file
crontab [ -u user ] [ -i ] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user‘s crontab)
-l (list user‘s crontab)
-r (delete user‘s crontab)
-i (prompt before deleting user‘s crontab)
无-u即root

规则语法格式:
以行为单位,一行一计划。
分 时 日 月 周 需要执行的命令
0-59 0-23 1-31 1-12 0-6 reboot
* 通配符;
/ 比如*/10,表示每10分钟执行一次;
- 区间分隔;
, 多个取值;比如想在1点,2点,4点各执行一次,则在时位置:1,2,4

crontab -e
* * * * * echo "hello linux" >> ~/temp1.txt
crontab: installing new crontab //存储退出后

/etc/cron.deny
/etc/cron.allow
同一用户名称同时在两个名单或同时不在都可编辑计划任务。

linux-计划任务

标签:let   file   list   etc   rom   计划任务   需要   boot   名称   

原文地址:https://www.cnblogs.com/dailycode/p/9382653.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!