at命令例行工作

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
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值