...........................................................................................................................................................
9.1 一次性调度执行
Schedule one-time tasks with at.
...........................................................................................................................................................
9.1.1 at命令
设置按时执行任务(只能执行一次)。
...........................................................................................................................................................
at
命令的基本语法如下:
at [参数] TIME
...........................................................................................................................................................
参数说明:
-
-m
当指定的任务被完成后,将给用户发送邮件 -
-l
等同于atq命令。列出当前用户的at任务列表 -
-d
等同于atrm命令。删除当前用户的at任务 -
-v
显示任务将被执行的时间 -
-c
输出任务的内容到标准输出 -
-f
从指定文件读入任务 -
TIME 指定执行的时间。 8:50 p.m , May07, +10 days, tomorrow, now, noon ,midnight ..
例:
...........................................................................................................................................................
当前时刻5分钟之后执行
now +5min
...........................................................................................................................................................
第二天下午
teatime tomorrow (teatime is 16:00)
...........................................................................................................................................................
第四天中午
noon +4 days
...........................................................................................................................................................
确定日期执行
5pm august 3 2009
4:00 2023-11-29
...........................................................................................................................................................
例:
1.设置一次性任务计划
# 设置执行时间 at now +5min # 设置执行任务 useradd wang # 结束执行任务编写 CTRL+D
...........................................................................................................................................................
2.查询任务
atq
...........................................................................................................................................................
3.验证结果
id wang
...........................................................................................................................................................
Guff_hys_python数据结构,大数据开发学习,python实训项目-CSDN博客