linux中一次性计划任务服务at命令

 

1、创建计划任务服务

[root@centos7pc1 test2]# ls
[root@centos7pc1 test2]# date
Wed Apr  6 17:16:12 CST 2022
[root@centos7pc1 test2]# at now+2 min   ## 设置任务时间, 2分钟后
at> touch a.txt          ## 设置执行的命令
at> <EOT>                ## ctrl + D
job 11 at Wed Apr  6 17:18:00 2022

 

 

2、查看任务

[root@centos7pc1 test2]# at -l
11      Wed Apr  6 17:18:00 2022 a root

 

3、查看执行结果

[root@centos7pc1 test2]# ls
a.txt
[root@centos7pc1 test2]# date
Wed Apr  6 17:18:33 CST 2022

 

4、删除任务

[root@centos7pc1 test2]# at -l
[root@centos7pc1 test2]# at now+2 hours    ## 创建一次性计划任务服务
at> touch b.txt
at> <EOT>
job 12 at Wed Apr  6 19:19:00 2022
[root@centos7pc1 test2]# at -l             ## 查看
12      Wed Apr  6 19:19:00 2022 a root
[root@centos7pc1 test2]# atrm 12           ## 删除一次性计划任务服务
[root@centos7pc1 test2]# at -l

 

posted @ 2022-04-06 09:21  小鲨鱼2018  阅读(200)  评论(0编辑  收藏  举报