自学内容网 自学内容网

【RHCE】计划任务的练习题

1. 使⽤ at 命令计划从现在起三分钟后运⾏⼀项作业。该作业必须将 date 命令的输出保存
⾄ /root/myjob.txt
[root@localhost ~]# at now +3 min
warning: commands will be executed using /bin/sh
at> date > /root/myjob.txt
at> <EOT>

2. 使⽤ at 命令以交互⽅式将作业排⼊将在 teatime (16:00)运⾏的队列 g。该作业将执
⾏向 /home/redhat/tea.txt 中显⽰消息 It's teatime 的命令。新消息应附加⾄⽂件
[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 13 at Fri Jul 12 16:00:00 2024

3. 使⽤ at 命令以交互⽅式将另⼀作业排⼊将在 16:05 运⾏的队列 b。该作业将执⾏向
/home/redhat/cookies.txt 中显⽰消息 The cookies are good 的命令。新消息应附加⾄
⽂件 /home/redhat/cookies.txt。
[root@localhost ~]# at -q b 16:05
warning: commands will be executed using /bin/sh
at> echo "the cookies" > /home/redhat/cookies.txt
at> <EOT>
job 14 at Fri Jul 12 16:05:00 2024

4. 检查待处理作业中的命令。
查看待执行的内容:atq
检查待执行:at -c 任务号
5. 使⽤ atq 命令查看将在 teatime 运⾏的作业的作业编号,使⽤ atrm 命令将该作业删
除。
atq
at -c teatime的任务号
6. 验证作业是否删除
删除任务:atrm 任务号
检查: atq

原文地址:https://blog.csdn.net/m0_64570996/article/details/140371527

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!