at命令操作,这是一个交互式的命令。at命令会将例行工作写入/var/spool/at目录
设置的是在未来的某个时间点去执行这个例行工作,需要等待这个设置的时间,然后取用和执行我们的例行工作。
如何取设置例行工作:at命令
at [-mldv] TIME-m: Send mail to the user when the job has completed even if there was no output
当任务执行完成之后,发送邮件给用户,即使没有输出
-l: Is an alias for atq => atq命令的别名
atq: lists the user's pending jobs 列出待执行任务
-d: Is an alias for atrm : atrm的别名
atrm: at rm => 删除的命令: deletes jobs, identified by their job number 删除例行工作 通过工作编号
-v: Shows the time the job will be executed before reading the job
展示在读取工作之前工作将要被执行的时间
-c: cats the jobs listed on the command line to standard output. # 列出例行工作到标准输出
-f: file Reads the job from file rather than standard input: 从文件读取例行工作TIME:TIME的格式
HH:MM小时:分钟:在某一天的那个时间去执行
midnight,noon,teatime:半夜,中午,下午
MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY or [CC]YY-MM-DD
MMDDYY, MM/DD/YY DD.MM.YY YY-MM-DD
now + count time-units: now + 4 minutes
单位可以有分钟(minutes),小时(hours),天(days),周(weeks)
today tomorrow样例:
at 4pm + 3 days
at 10am Jul 31
at 1am tomorrow
按 ctrl + d结束
例子:
[root@rhce etc]# echo "123" > /dev/pts/2
[root@rhce etc]# at now + 2 minutes
warning: commands will be executed using /bin/sh
at> echo "123" > /dev/pts/2
at> <EOT>
job 3 at Tue Jan 11 03:55:00 2022