atq1

Scheduling commands in IT environments are important. There are tools like at , atq , atrm , batch . We will look all of them in this tutorial.

在IT环境中安排命令很重要。 有一些工具,例如atatqatrmbatch 。 我们将在本教程中查找所有这些内容。

安排工作时间 (Schedule Job At)

While scheduling jobs we will use at command. At command have very causal time specification. We will look varying time specification in the next example in detail. Now we simply schedule job.

在计划作业时,我们将使用at命令。 在命令中有非常因果的时间规范。 在下一个示例中,我们将详细介绍变化的时间规范。 现在我们只需安排工作。

$ at 20:58

Schedule Job At
安排工作时间

We will run mkdir test command  at 20:58 . In order to accomplish this we run following steps.

我们将在20:58运行mkdir test命令。 为了做到这一点,我们运行以下步骤。

  • at 20:58 will run following commands at 20:58

    at 20:58将在运行下面的命令20:58

  • mkdir test is the command we want to run specified time

    mkdir test是我们要在指定时间运行的命令

  • We can give more than one command for each line of prompt but we can end the commands with CTRL+d which will give an output like <EOT>

    我们可以为每一行提示提供多个命令,但可以使用CTRL+d结束命令,这将给出类似<EOT>的输出

时间格式(Time Formats)

at command supports a lot of different type of time specification. Here some of them.

at命令支持许多不同类型的时间规范。 这里有一些。

  • noon will run 12:00 PM

    noon将运行12:00 PM

  • midnight will run 12:00 AM

    midnight将运行12:00 AM

  • teatime will run 4:00 PM

    teatime将运行4:00 PM

  • tomorrow will run next day same time

    tomorrow将同时运行

  • next week will run next week

    next week将在下周运行

  • fri will run Friday

    fri将运行周五

  • next monday will run next monday

    next monday将在下周一运行

  • now + 1 hour will run after 1 hour

    now + 1 hour将在1小时后运行

  • now + 3 weeks will run after 3 weeks

    now + 3 weeks将在3周后运行

安排相对时间的工作(Schedule Job With Relative Time)

As we have seen a lot of different time expressions in previous example we can use them in our examples. In this example we will set time relatively which means we will set time according to current time. To specify relative time we will use now time specifiers with count . In the example we will set command to run after 15 minutes.

正如我们在前面的示例中看到的很多不同的时间表达式一样,我们可以在示例中使用它们。 在此示例中,我们将相对设置时间,这意味着我们将根据当前时间设置时间。 为了指定相对时间,我们将now使用带有count时间说明符。 在示例中,我们将命令设置为在15分钟后运行。

$ at now + 15 minutes

Schedule Job With Relative Time
安排相对时间的工作

We can see from screenshot that the command is set to run at 21:31 which is after 15 minutes from now. We can see that this job is numbered 2

从屏幕截图中我们可以看到,该命令设置为从现在开始15分钟后的21:31运行。 我们可以看到这份工作编号为2

查看所有计划作业 (View All The Schedules Jobs)

In a busy system there may be a lot of scheduled jobs. Listing them can be done with atq command.

在繁忙的系统中,可能会有很多计划的作业。 列出它们可以使用atq命令完成。

$ atq

View All The Schedules Jobs
查看所有计划作业

We can see that there is only one job in the list. This job is numbered as 2 . This job will e run at Thu Mar 9 21:31:00 . The job is created by user ismail

我们可以看到列表中只有一项工作。 这项工作被编号为2 。 这项工作将在Thu Mar 9 21:31:00 。 该作业由用户ismail创建

删除/删除预定作业(Remove/Delete A Scheduled Jobs)

We can also remove jobs that not run. We need the job ID which can be listed with atq . We will provide job ID to the atrm command like below. We will remove job ID 2 .

我们还可以删除未运行的作业。 我们需要可以用atq列出的工作ID。 我们将为atrm命令提供工作ID,如下所示。 我们将删除作业ID 2

$ atrm 2

Remove/Delete A Scheduled Jobs
删除/删除预定作业

根据平均负载执行作业(Execute Jobs According to Load Average)

We can set for different times for our jobs. But some times just setting time is not enough or not suitable for our situation. There is an alternative way to schedule command We can use batch command to run commands if load average is less than 1.5 . In the example we will run echo "Run reports"

我们可以为工作设置不同的时间。 但是有时候仅仅设定时间是不够的,或者不适合我们的情况。 还有另一种调度命令的方法,如果平均负载小于1.5则可以使用batch命令来运行命令。 在示例中,我们将运行echo "Run reports"

$ batch

Execute Jobs According to Load Average
根据平均负载执行作业

从文件重新加载作业(Reload Jobs From A File)

Another useful feature is reading commands from a file. As we know commands are read from an interactive shell. We can provide commands to be run at scheduled time. We will use -f option and the command file name to use this feature. In the example we will read commands file named myjobs.txt and run them after 2 days.

另一个有用的功能是从文件读取命令。 众所周知,命令是从交互式外壳读取的。 我们可以提供要在预定时间运行的命令。 我们将使用-f选项和命令文件名来使用此功能。 在示例中,我们将读取名为myjobs.txt命令文件,并在两天后运行它们。

$ at -f myjobs.txt now + 2 days

Reload Jobs From A File
从文件重新加载作业

允许和拒绝用户计划作业(Allow and Deny User To Schedule Job)

By default all users in Linux system can create scheduled jobs. This may create some problems or security issues or simply it is unwanted situation. We can set rules to allow or deny some user from scheduling commands.

默认情况下,Linux系统中的所有用户都可以创建计划的作业。 这可能会引起一些问题或安全性问题,或者仅仅是不希望的情况。 我们可以设置规则以允许或拒绝某些用户调度命令。

.u5b80ddfd6df5c216ab9387ad45bec063 , .u5b80ddfd6df5c216ab9387ad45bec063 .postImageUrl , .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text-area { min-height: 80px; position: relative; } .u5b80ddfd6df5c216ab9387ad45bec063 , .u5b80ddfd6df5c216ab9387ad45bec063:hover , .u5b80ddfd6df5c216ab9387ad45bec063:visited , .u5b80ddfd6df5c216ab9387ad45bec063:active { border:0!important; } .u5b80ddfd6df5c216ab9387ad45bec063 .clearfix:after { content: ""; display: table; clear: both; } .u5b80ddfd6df5c216ab9387ad45bec063 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u5b80ddfd6df5c216ab9387ad45bec063:active , .u5b80ddfd6df5c216ab9387ad45bec063:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text-area { width: 100%; position: relative; } .u5b80ddfd6df5c216ab9387ad45bec063 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u5b80ddfd6df5c216ab9387ad45bec063 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u5b80ddfd6df5c216ab9387ad45bec063 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u5b80ddfd6df5c216ab9387ad45bec063:hover .ctaButton { background-color: #E67E22!important; } .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u5b80ddfd6df5c216ab9387ad45bec063 .u5b80ddfd6df5c216ab9387ad45bec063-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u5b80ddfd6df5c216ab9387ad45bec063:after { content: ""; display: block; clear: both; }

LEARN MORE  Batch File Commands For Windows MSDOS

.u5b80ddfd6df5c216ab9387ad45bec063 , .u5b80ddfd6df5c216ab9387ad45bec063 .postImageUrl , .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text-area { min-height: 80px; position: relative; } .u5b80ddfd6df5c216ab9387ad45bec063 , .u5b80ddfd6df5c216ab9387ad45bec063:hover , .u5b80ddfd6df5c216ab9387ad45bec063:visited , .u5b80ddfd6df5c216ab9387ad45bec063:active { border:0!important; } .u5b80ddfd6df5c216ab9387ad45bec063 .clearfix:after { content: ""; display: table; clear: both; } .u5b80ddfd6df5c216ab9387ad45bec063 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u5b80ddfd6df5c216ab9387ad45bec063:active , .u5b80ddfd6df5c216ab9387ad45bec063:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text-area { width: 100%; position: relative; } .u5b80ddfd6df5c216ab9387ad45bec063 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u5b80ddfd6df5c216ab9387ad45bec063 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u5b80ddfd6df5c216ab9387ad45bec063 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u5b80ddfd6df5c216ab9387ad45bec063:hover .ctaButton { background-color: #E67E22!important; } .u5b80ddfd6df5c216ab9387ad45bec063 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u5b80ddfd6df5c216ab9387ad45bec063 .u5b80ddfd6df5c216ab9387ad45bec063-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u5b80ddfd6df5c216ab9387ad45bec063:after { content: ""; display: block; clear: both; }

了解更多用于Windows MSDOS的批处理文件命令

There is two configuration file to configure this.

有两个配置文件可以对此进行配置。

  • at.allow is used to set allowed users

    at.allow用于设置允许的用户

  • at.deny is used to set denied users

    at.deny用于设置拒绝的用户

翻译自: https://www.poftut.com/linux-scheduling-commands-atq-atrm-batch-examples/

atq1

atq1_使用at,atq,atrm和batchLinux调度命令示例相关推荐

  1. linux 定时执行任务 at atq atrm命令的使用

    1.at命令在指定时刻执行指定的命令序列 at [-V] [-q 队列] [-f 文档名] [-mldbv] 时间 下面对命令中的参数进行说明. -V 将标准版本号打印到标准错误中. -q queue ...

  2. 鸟哥的Linux私房菜(基础篇)- 第十六章、例行性工作排程 (crontab)

    第十六章.例行性工作排程 (crontab) 最近升级日期:2009/09/11 学习了基础篇也一阵子了,你会发现到为什么系统常常会主动的进行一些任务?这些任务到底是谁在配置工作的?如果你想要让自己设 ...

  3. 后台执行UNIX/Linux命令和脚本的五种方法

    http://hankjin.blog.163.com/blog/static/337319372010111492348473/ 2010-12-14 09:35:48|  分类: Unix |   ...

  4. Linux学习-仅执行一次的工作排程

    atd 的启动与 at 运作的方式 要使用单一工作排程时,我们的 Linux 系统上面必须要有负责这个排程的服务,那就是 atd 这个玩 意儿. 不过并非所有的 Linux distributions ...

  5. ue 编写linux脚本,UltraEdit23 sh文件 (shell脚本)着色

    网上有UltraEdit早期版本的添加方法: 但是这新版本有点不同: 方法如下: 安装后,到AppData\Roaming\IDMComp\UltraEdit\wordfiles 目录下添加UnixS ...

  6. linux的任务计划6,Linux计划任务

    Linux计划任务: 未来的某个时间执行一次任务,或者周期性执行某个任务,执行结果会通过邮件通知 定时任务:at batch 周期性任务:crontab 系统任务调度:/ect/crontab 用户任 ...

  7. [译]后台执行UNIX/Linux命令和脚本的五种方法

    原文:http://www.thegeekstuff.com/2010/12/5-ways-to-execute-linux-command/ by SathiyaMoorthy on Decembe ...

  8. 例行性工作 排程(crontab)

    一,什么是例行性工作排程? 计划任务:比如每天,每周,每月,每年或者指定时间需要执行的工作任务 1,Linux工作排程的种类:at,cron a)at :at 处理仅执行一次任务,依赖于atd服务 b ...

  9. linux 例行性工作,鳥哥的 Linux 私房菜

    15.2.2 實際運作單一工作排程 單一工作排程的進行就使用 at 這個指令囉!這個指令的運作非常簡單!將 at 加上一個時間即可!基本的語法如下: [root@study ~]# at [-mldv ...

  10. linux下批量下载站点内容初稿

    此脚本适用于站点命名内容很有规律的网址,下载后会自动将文件拷贝到对应目录中,已测试过 尤其适合下图片 vi wgetlist #!/bin/bash #批量下载 mkdir -p 2010{1..12 ...

最新文章

  1. 权限表管理之更新权限表数据
  2. aix-syslog
  3. ubuntu16.04分区
  4. 使用opencv训练cascade分类器进行目标检测
  5. python3连接sql server数据库_Python3操作SQL Server数据库(实例讲解)
  6. 蓝桥杯第七届决赛JAVA真题----广场舞
  7. JAVA企业级快速开发平台,JEECG 3.7.3 新春版本发布
  8. 10张漫画解释进程与线程的区别与联系
  9. 提取tsv数据并转化成json——致找不出怎么提取tsv文件中数据的五小时
  10. oracle 和mysql有什么区别_mysql和oracle的区别有哪些
  11. easyui combobox根据输入内容动态查找_制作智能下拉菜单,自动筛选想要输入的数据,同事都看呆了...
  12. 从海康7816的ps流里获取数据h264数据
  13. 优秀技能经验及对java学习展望
  14. spring中@Autowired注解的原理
  15. mac查看内存使用情况命令
  16. 多Excel文件内容查询工具
  17. 模块加载失败请确保该二进制存储在指定路径中
  18. 安卓Hook微信-计步器、万能骰子、自动回复、反撤回、抢红包思路分享
  19. \t\tMy philosophy
  20. MATLAB 神经网络训练参数解释

热门文章

  1. 【毕业设计系列】005:视频图像数字水印matlab GUI系统设计
  2. java微博分享代码实例
  3. 众多尼龙VRay材质球素材一键即可获取
  4. Audio Effect
  5. YYC采集工具python语言精简方便实用的视频采集工具
  6. 【kali-漏洞利用】(3.3)Metasploit后渗透(下):后渗透模块使用
  7. linux中的apche服务
  8. android应用程序开发需要掌握的基础知识
  9. java实现角色+武器攻击小游戏
  10. D-013 蜂鸣器硬件电路设计