题目:
1. 使⽤ at 命令计划从现在起三分钟后运⾏⼀项作业。该作业必须将 date 命令的输出保存⾄ /root/myjob.txt
2. 使⽤ at 命令以交互⽅式将作业排⼊将在 teatime (16:00)运⾏的队列 g。该作业将执⾏向 /home/redhat/tea.txt 中显⽰消息 It's teatime 的命令。新消息应附加⾄⽂件 /home/redhat/tea.txt。
3. 使⽤ at 命令以交互⽅式将另⼀作业排⼊将在 16:05 运⾏的队列 b。该作业将执⾏向 /home/redhat/cookies.txt 中显⽰消息 The cookies are good 的命令。新消息应附加⾄ ⽂件 /home/redhat/cookies.txt。
4. 检查待处理作业中的命令。
5. 使⽤ atq 命令查看将在 teatime 运⾏的作业的作业编号,使⽤ atrm 命令将该作业删除。
6. 验证作业是否删除
答案:
1.
[root@localhost ~]# at now + 3 minutes
warning: commands will be executed using /bin/sh
at> date > /root/myjob.txt
at> <EOT>
注意:<EOT>不是手动输入,而是ctrl+d
2.
[root@localhost ~]# at -q g teatime
warning: commands will be executed using /bin/sh
at> echo It's teatime >> /home/redhat/tea.txt
at> <EOT>
job 12 at Fri Jul 12 16:00:00 2024
3.
[root@localhost ~]# at -q b 16:05
warning: commands will be executed using /bin/sh
at> echo The cookies are good >> /home/redhat/cookies.txt
at> <EOT>
job 13 at Fri Jul 12 16:05:00 2024
4.
# 查看作业编号
[root@localhost ~]# atq
[root@localhost ~]# at -c 作业编号
5.
[root@localhost ~]# atq
[root@localhost ~]# atrm 作业编号
6.
[root@localhost ~]# atq