File tree 1 file changed +30
-11
lines changed 1 file changed +30
-11
lines changed Original file line number Diff line number Diff line change 5
5
6
6
## 补充说明
7
7
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(日.月.年)。指定的日期必须跟在指定时间的后面。
9
9
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(明天)来指定完成命令的时间。
11
11
12
- ### 语法
12
+ ### 语法
13
13
14
14
``` shell
15
15
at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
16
16
```
17
17
18
- ### 选项
18
+ ### 选项
19
19
20
20
``` shell
21
21
-f:指定包含具体指令的任务文件;
@@ -25,13 +25,13 @@ at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
25
25
-m:任务执行完成后向用户发送E-mail。
26
26
```
27
27
28
- ### 参数
28
+ ### 参数
29
29
30
30
日期时间:指定任务执行的日期时间。
31
31
32
- ### 实例
32
+ ### 示例
33
33
34
- 三天后的下午 5 点锺执行 ` /bin/ls ` :
34
+ 三天后的下午 5 点钟执行 ` /bin/ls ` :
35
35
36
36
``` shell
37
37
[root@localhost ~ ]# at 5pm+3 days
@@ -60,10 +60,6 @@ job 8 at 2013-01-06 17:20
60
60
删除已经设置的任务:
61
61
62
62
``` shell
63
- [root@localhost ~ ]# atq
64
- 8 2013-01-06 17:20 a root
65
- 7 2013-01-08 17:00 a root
66
-
67
63
[root@localhost ~ ]# atrm 7
68
64
[root@localhost ~ ]# atq
69
65
8 2013-01-06 17:20 a root
@@ -80,5 +76,28 @@ umask 22此处省略n个字符
80
76
date > /root/2013.log
81
77
```
82
78
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
+ 指定任务队列执行任务:
83
88
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
+ ```
84
95
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