File tree Expand file tree Collapse file tree 1 file changed +30
-11
lines changed Expand file tree Collapse file tree 1 file changed +30
-11
lines changed Original file line number Diff line number Diff line change 55
66## 补充说明
77
8- ** at命令** 用于在指定时间执行命令。at允许使用一套相当复杂的指定时间的方法。它能够接受在当天的hh: mm (小时:分钟)式的时间指定。假如该时间已过去,那么就放在第二天执行。当然也能够使用midnight(深夜),noon(中午),teatime(饮茶时间,一般是下午4点)等比较模糊的 词语来指定时间 。用户还能够采用12小时计时制,即在时间后面加上AM(上午)或PM(下午)来说明是上午还是下午。 也能够指定命令执行的具体日期,指定格式为month day(月 日)或mm/dd/yy(月/日/年)或dd.mm.yy(日.月.年)。指定的日期必须跟在指定时间的后面。
8+ ** at命令** 用于在指定时间执行命令。at允许使用一套相当复杂的指定时间的方法。它能够接受在当天的hh: mm (小时:分钟)式的时间指定。假如该时间已过去,那么就放在第二天执行。当然也能够使用midnight(深夜),noon(中午),teatime(饮茶时间,一般是下午4点)等比较模糊的词语来指定时间 。用户还能够采用12小时计时制,即在时间后面加上AM(上午)或PM(下午)来说明是上午还是下午。也能够指定命令执行的具体日期,指定格式为month day(月 日)或mm/dd/yy(月/日/年)或dd.mm.yy(日.月.年)。指定的日期必须跟在指定时间的后面。
99
10- 上面介绍的都是绝对计时法,其实还能够使用相对计时法,这对于安排不久就要执行的命令是很有好处的。指定格式为:` now + count time-units ` ,now就是当前时间,time-units是时间单位,这里能够是minutes(分钟)、hours(小时)、days(天)、weeks(星期)。count是时间的数量,究竟是几天,还是几小时,等等。 更有一种计时方法就是直接使用today(今天)、tomorrow(明天)来指定完成命令的时间。
10+ 上面介绍的都是绝对计时法,其实还能够使用相对计时法,这对于安排不久就要执行的命令是很有好处的。指定格式为:` now + count time-units ` ,now就是当前时间,time-units是时间单位,这里能够是minutes(分钟)、hours(小时)、days(天)、weeks(星期)。count是时间的数量,究竟是几天,还是几小时,等等。更有一种计时方法就是直接使用today(今天)、tomorrow(明天)来指定完成命令的时间。
1111
12- ### 语法
12+ ### 语法
1313
1414``` shell
1515at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
1616```
1717
18- ### 选项
18+ ### 选项
1919
2020``` shell
2121-f:指定包含具体指令的任务文件;
@@ -25,13 +25,13 @@ at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
2525-m:任务执行完成后向用户发送E-mail。
2626```
2727
28- ### 参数
28+ ### 参数
2929
3030日期时间:指定任务执行的日期时间。
3131
32- ### 实例
32+ ### 示例
3333
34- 三天后的下午 5 点锺执行 ` /bin/ls ` :
34+ 三天后的下午 5 点钟执行 ` /bin/ls ` :
3535
3636``` shell
3737[root@localhost ~ ]# at 5pm+3 days
@@ -60,10 +60,6 @@ job 8 at 2013-01-06 17:20
6060删除已经设置的任务:
6161
6262``` shell
63- [root@localhost ~ ]# atq
64- 8 2013-01-06 17:20 a root
65- 7 2013-01-08 17:00 a root
66-
6763[root@localhost ~ ]# atrm 7
6864[root@localhost ~ ]# atq
69658 2013-01-06 17:20 a root
@@ -80,5 +76,28 @@ umask 22此处省略n个字符
8076date > /root/2013.log
8177```
8278
79+ 使用任务文件执行任务:
80+
81+ ``` shell
82+ [root@localhost ~ ]# echo "/bin/ls" > mytask.txt
83+ [root@localhost ~ ]# at -f mytask.txt 5pm+3 days
84+ job 9 at 2013-01-08 17:00
85+ ```
86+
87+ 指定任务队列执行任务:
8388
89+ ``` shell
90+ [root@localhost ~ ]# at -q b 5pm+3 days
91+ at> /bin/ls
92+ at> < EOT>
93+ job 10 at 2013-01-08 17:00
94+ ```
8495
96+ 任务执行完成后发送E-mail通知:
97+
98+ ``` shell
99+ [root@localhost ~ ]# at -m 5pm+3 days
100+ at> /bin/ls
101+ at> < EOT>
102+ job 11 at 2013-01-08 17:00
103+ ```
You can’t perform that action at this time.
0 commit comments