![linux调度的命令](https://i-blog.csdnimg.cn/blog_migrate/eff08a2feceb1d0a0b55e17f9168af80.png)
linux调度的命令
![A terminal window on a Linux system.](https://i-blog.csdnimg.cn/blog_migrate/2d4fe9a1dab0856737b6384255183879.png)
If you want to schedule a Linux job that will happen only once, cron
is overkill. The at
family of commands is what you need! And if you want to run processes only when your system has free resources, you can use batch
.
如果您要安排仅执行一次Linux作业,那么cron
实在是太过分了。 您需要的at
系列命令! 而且,如果只在系统拥有可用资源时才运行进程,则可以使用batch
。
如何安排Linux作业 (How to Schedule Linux Jobs)
The cron
daemon maintains a list of jobs it runs at specific times. These tasks and programs run in the background at the scheduled times. This offers you great flexibility for scheduling tasks that need to be repeated. Whether you need to run a task once every hour, at a specific time each day, or once a month or year, you can set it up in cron
.
cron
守护程序维护在特定时间运行的作业列表。 这些任务和程序在计划的时间在后台运行。 这为您安排需要重复的任务提供了极大的灵活性。 无论您需要每小时,每天特定时间还是每月或每年一次运行任务,都可以在cron
进行设置。
However, this doesn’t help if you want to schedule a task to run just once. Sure, you can set it up in cron
, but then you have to remember to go back and remove the crontab entry after the task executes, which is inconvenient.
但是,如果您只想安排一个任务运行一次,这将无济于事。 当然,您可以在cron
进行设置,但是之后您必须记住要在任务执行后返回并删除crontab条目,这很不方便。
With Linux, if you’re struggling with a problem, it’s almost a guarantee someone else has struggled with it, too. Fortunately, because Unix-like operating systems have been around so long, there’s also an excellent chance someone has created a solution to your problem.
使用Linux时,如果您遇到问题,也几乎可以确保其他人也对此感到困难。 幸运的是,由于类似Unix的操作系统已经存在了很长时间,因此也很有可能有人为您的问题创建了解决方案。
For the problem outlined above, they have, and it’s called at
.
对于这个问题上面列出,它们有,它就是所谓at
。
安装at命令 (Installing the at Command)
We had to install at
on Ubuntu 18.04 and Manjaro 18.1.0 (it was already installed on Fedora 31).
我们必须要安装at
Ubuntu上18.04和Manjaro 18.1.0(它已经被安装在Fedora 31)。
To install at
on Ubuntu, use this command:
要at
Ubuntu上安装,请使用以下命令:
sudo apt-get install at
![The "sudo apt-get install at" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/5d35cf7fc3a527ead14475e045559ae5.png)
After the installation completes, you can start the at
daemon with this command:
安装完成后,可以使用以下命令启动at
守护程序:
sudo systemctl enable --now atd.service
![The "sudo systemctl enable --now atd.service" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/be814b9b2a445e7213a04d4f159973b7.png)
On Manjaro, you install at
with this command:
在Manjaro,安装at
使用此命令:
sudo pacman -Sy at
![The "sudo pacman -Sy at" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/c1189b782ab58c009b90d4492625295e.png)
After the installation completes, type this command to start the at
daemon:
安装完成后,键入以下命令以启动at
守护程序:
sudo systemctl enable --now atd.service
![The "sudo systemctl enable --now atd.service" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/4cebc639c5bf7a1bc03c99519cee1a7a.png)
On any distribution, you can type this command to make sure the atd
daemon is running:
在任何发行版上,您可以键入以下命令以确保atd
守护程序正在运行:
ps -e | grep atd
![The "ps -e | grep atd" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/5a9aa3ade548bade664160147c14bde1.png)
如何交互使用at命令 (How to Use the at Command Interactively)
To use at
, you have to assign it a date and time to run. There’s a great deal of flexibility in the way you can write these, which we cover later in this article.
要使用at
,你必须为它分配一个日期和时间来运行。 您可以很灵活地编写这些内容,我们将在本文后面介绍。
However, even though we’re going to use at
interactively, you have to provide the date and time upfront. If you don’t include anything on the command line, or you type something that isn’t a date and time, at
responds with “Garbled time,” as shown below:
然而,即使我们要使用at
交互,你必须提供的日期和时间的前期。 如果您在命令行中未包含任何内容,或者您键入的不是日期和时间,则at
响应时显示“乱码时间”,如下所示:
at
at banana
![An incorrect use of the "at" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/bb2334e954aad9130bafdf430719a03e.png)
Dates and times can be explicit or relative. For example, let’s say you want to have a command execute one minute from now. at
knows what “now” means, so you can use now
and add one minute to it, like so:
日期和时间可以是明确的也可以是相对的。 例如,假设您希望从现在开始一分钟执行一条命令。 at
知道“现在”的意思,所以你可以使用now
一分钟添加到它,就像这样:
at now + 1 minute
![The "at now + 1 minute" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/421e729a7e4cdce55515b6605f07c4dd.png)
at
prints out a message and an at
prompt, and waits for you to type the commands you want to schedule. First, though, consider the message, as shown below:
at
输出一条消息和一个at
提示符,并等待您键入要计划的命令。 但是,首先考虑该消息,如下所示:
![The "at" command prompt in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/7e1e9ba61c4930d40360b1a65bd93f7d.png)
It tells you at
launches an instance of the sh
shell and will run the commands inside that. Your commands won’t be executed in the Bash shell, which is compatible with the sh
shell but has a richer feature set.
它at
启动时告诉您sh
shell的实例,并将在其中运行命令。 您的命令不会在Bash Shell中执行,后者与sh
Shell兼容,但具有更丰富的功能集。
If your commands or scripts try to use a function or facility that Bash provides, but sh
doesn’t, they’ll fail.
如果您的命令或脚本尝试使用Bash提供的功能或设施,但sh
没有提供,它们将失败。
It’s easy to test whether your commands or scripts will run in sh
. Use the sh
command to start an sh
shell:
测试您的命令或脚本是否将在sh
运行很容易。 使用sh
命令启动sh
shell:
sh
![The "sh" shell in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/376780bef7bd7af2517a5a774cd56b6a.png)
The command prompt changes to a dollar sign ($
), and you can now run your commands and verify that they operate correctly.
命令提示符更改为美元符号( $
),您现在可以运行命令并验证其是否正常运行。
To return to the Bash shell, type the exit
command:
要返回到Bash shell,请键入exit
命令:
exit
You won’t see any standard output or error messages from the commands. This is because the sh
shell launches as a background task and runs without any sort of screen interface.
您不会从命令中看到任何标准输出或错误消息。 这是因为sh
shell作为后台任务启动,并且在没有任何屏幕界面的情况下运行。
Any output from the commands—good or bad—is emailed to you. It’s sent via the internal mail system to whomever runs the at
command. This means you have to set up and configure that internal email system.
命令的任何输出(无论好坏)都会通过电子邮件发送给您。 它通过内部邮件系统发送给运行at
命令的任何人。 这意味着您必须设置和配置该内部电子邮件系统。
Many (most) Linux systems don’t have an internal email system as there’s rarely a need for one. Those that do typically use a system like sendmail or postfix. If your system doesn’t have an internal email system, you can have scripts write to files or redirect output to files to add logging.
许多(大多数)Linux系统没有内部电子邮件系统,因为很少需要一个内部电子邮件系统。 那些确实使用诸如sendmail或postfix之类的系统的公司。 如果您的系统没有内部电子邮件系统,则可以使脚本写入文件或将输出重定向到文件以添加日志记录。
If the command doesn’t generate any standard output or error messages, you won’t get an email, anyway. Many Linux commands indicate success via silence, so in most cases, you won’t get an email.
如果该命令未生成任何标准输出或错误消息,则无论如何您都不会收到电子邮件。 许多Linux命令通过静默指示成功,因此在大多数情况下,您不会收到电子邮件。
Now, it’s time to type a command in at
. For this example, we’ll use a small script file called sweep.sh
that deletes the *.bak
, *.tmp
, and *.o
files. Type the path to the command, as shown below, and then press Enter.
现在,是时候在键入命令at
。 在此示例中,我们将使用一个名为sweep.sh
的小脚本文件,该文件将删除*.bak
, *.tmp
和*.o
文件。 键入命令的路径,如下所示,然后按Enter。
![The "~/sweep.sh" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/41ff975e36f8b107724ad08a4d2cf2b3.png)
Another command prompt appears, and you can add as many commands as you like. It’s usually more convenient to have your commands in a single script and simply call that script from within at
.
出现另一个命令提示符,您可以根据需要添加任意数量的命令。 它通常有在一个脚本你的命令,更方便,更简单地调用脚本中at
。
Press Ctrl+D to tell at
you’re finished adding commands. at
shows <EOT>, which means end of transmission. You’re told the job number and when the job is scheduled to run, as shown below:
按Ctrl + d告诉at
添加完命令。 at
显示<EOT>时,表示传输结束。 系统将告知您作业编号以及该作业的预定运行时间,如下所示:
![Confirmation of "job 4" scheduled to run "Wed Dec 18 08:37:00 2019" in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/e3f5e5d9296e745db6bcc40030f12c15.png)
After the job executes, type the following to check your internal mail:
作业执行后,键入以下内容检查您的内部邮件:
mail
![The "mail" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/e2a87085a2549acb3395e8e02852d488.png)
If there’s no mail, you have to assume success. Of course, in this case, you can check and see if the *.bak
, *.tmp
, and *.o
files were deleted to confirm the command worked.
如果没有邮件,则必须承担成功。 当然,在这种情况下,您可以检查*.bak
, *.tmp
和*.o
文件是否已删除,以确认命令是否有效。
Type the following to run the whole thing again:
键入以下内容以再次运行整个过程:
at now + 1 minute
![The "at now + 1 minute" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/0637bdec6a01342fd9076c09c1e1dc47.png)
After one minute, type the following to recheck your mail:
一分钟后,键入以下内容以重新检查您的邮件:
mail
![The "mail" command indicating "1 message 1 unread" in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/a54df7429483f78ba0e5f4980d956a65.png)
Hey, we’ve got mail! To read message number one, press 1, and then hit Enter.
嘿,我们收到邮件了! 要阅读第一条消息,请按1,然后按Enter。
![An internal email in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/1c47b1376b187ef9f4016b976b405fc1.png)
We received an email from at
because the commands in the script generated error messages. In this example, there were no files to delete because when we ran the script previously, it removed them.
我们收到了一封来自的电子邮件at
因为脚本中的命令生成了错误消息。 在此示例中,没有要删除的文件,因为当我们先前运行脚本时,它删除了它们。
Press D+Enter to delete the email and Q+Enter to quit the mail program.
按D + Enter删除电子邮件,然后按Q + Enter退出邮件程序。
日期和时间格式 (Date and Time Formats)
You have a lot of flexibility when it comes to the time formats you can use with at
. Here are a few examples:
你有很大的灵活性,当谈到你可以使用的时间格式at
。 这里有一些例子:
Run at 11:00 a.m.:
在上午11:00运行:
at 11:00 AM
Run at 11:00 a.m.:
在上午11:00运行:
Run at 11:00 a.m. tomorrow:
明天上午11:00运行:
at 11:00 AM tomorrow
Run at 11:00 a.m. tomorrow:
明天上午11:00运行:
Run at 11:00 a.m. on this day next week:
在下周的这一天上午11:00运行:
at 11:00 AM next week
Run at 11:00 a.m. on this day next week:
在下周的这一天上午11:00运行:
Run at this time, on this day, next week:
在下周的这一天,今天这一天运行:
at next week
Run at this time, on this day, next week:
在下周的这一天,今天这一天运行:
Run at 11:00 a.m. next Friday:
在下周五上午11:00运行:
at 11:00 AM next fri
Run at 11:00 a.m. next Friday:
在下周五上午11:00运行:
Run at this time next Friday:
在下周五的这个时间运行:
at next fri
Run at this time next Friday:
在下周五的这个时间运行:
Run at 11:00 a.m. on this date, next month:
下个月的这个日期上午11:00运行:
at 11:00 AM next month
Run at 11:00 a.m. on this date, next month:
下个月的这个日期上午11:00运行:
Run at 11:00 a.m. on a specific date:
在特定日期的上午11:00运行:
at 11:00 AM 3/15/2020
Run at 11:00 a.m. on a specific date:
在特定日期的上午11:00运行:
Run 30 minutes from now:
从现在开始运行30分钟:
at now + 30 minutes
Run 30 minutes from now:
从现在开始运行30分钟:
Run two hours from now:
从现在开始运行两个小时:
at now + 2 hours
Run two hours from now:
从现在开始运行两个小时:
Run at this time tomorrow:
明天此时运行:
at tomorrow
Run at this time tomorrow:
明天此时运行:
Run at this time on Thursday:
在星期四的这个时间运行:
at thursday
Run at this time on Thursday:
在星期四的这个时间运行:
Run at 12:00 a.m.:
凌晨12:00运行:
at midnight
Run at 12:00 a.m.:
凌晨12:00运行:
Run at 12:00 p.m.:
晚上12:00运行:
at noon
Run at 12:00 p.m.:
晚上12:00运行:
If you’re a Brit, you can even schedule a command to run at teatime (4 p.m.):
如果您是英国人,您甚至可以安排在下午茶时间(下午4点)运行的命令:
at teatime
If you’re a Brit, you can even schedule a command to run at teatime (4 p.m.):
如果您是英国人,您甚至可以安排在下午茶时间(下午4点)运行的命令:
查看工作队列 (Looking at the Job Queue)
You can type the atq
command to see the queue of scheduled jobs, as shown below.
您可以键入atq
命令以查看预定作业的队列,如下所示。
![Output from the "atq" command showing 5 jobs in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/6cfc5d99310b19f249fc0c5885a5b22f.png)
For each command in the queue, atq
displays the following information:
对于队列中的每个命令, atq
显示以下信息:
Job ID
工作编号
Scheduled date
约定的日期
Scheduled time
计划的时间
Queue the job is in. The queues are labeled “a,” “b,” and so on. Normal tasks you schedule with
at
go into queue “a,” while tasks you schedule withbatch
(covered later in this article) go into queue “b.”正在将作业排队。 队列被标记为“ a”,“ b”等。 您预设标准的任务
at
进入队列“一”,而你的任务附表batch
(在本文后面介绍)进入队列“B”。The person who scheduled the job.
安排工作的人。
在命令行上使用at (Using at on the Command Line)
You don’t have to use at
interactively; you can also use it on the command. This makes it easier to use inside scripts.
您不必使用at
交互; 您也可以在命令上使用它。 这使得在内部脚本中更容易使用。
You can pipe commands into at
, like this:
您可以将命令通过管道传递到at
,如下所示:
echo "sh ~/sweep.sh" | at 08:45 AM
![An "echo "sh ~/sweep.sh" | at 08:45 AM" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/0638066a5633b49ee04b1f516b9d3db1.png)
The job is accepted and scheduled by at
, and the job number and execution date are reported just as before.
作业已在接受并安排at
,并且作业编号和执行日期的报告方式与以前一样。
与命令文件一起使用 (Using at with Files of Commands)
You can also store a sequence of commands in a file, and then pass it to at
. This can be a plain text file of commands—it doesn’t have to be an executable script.
您还可以在文件中存储一系列命令,然后将其传递给at
。 这可以是命令的纯文本文件-不必是可执行脚本。
You can use the -f
(file) option in the following way to pass a filename to at
:
您可以通过以下方式使用-f
(文件)选项,将文件名传递给at
:
at now + 5 minutes -f clean.txt
![An "at now + 5 minutes -f clean.txt" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/b6b7bdcd4fb73ae42366b6a4276ce386.png)
You can achieve the same result if you redirect the file into at
:
如果将文件重定向到以下位置at
则可以实现相同的结果:
at now + 5 minutes < clean.txt
![An "at now + 5 minutes < clean.txt" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/60bba84109d1e3847181eb9d43111013.png)
从队列中删除计划的作业 (Removing Scheduled Jobs from the Queue)
To remove a scheduled job from the queue, you can use the atrm
command. If you want to see the queue first to find the number of the job you want to remove, you can use atq
. Then, use that job number with atrm
, as shown below:
要从队列中删除计划的作业,可以使用atrm
命令。 如果要首先查看队列以查找要删除的作业编号,则可以使用atq
。 然后,将该工作号与atrm
,如下所示:
atq
atrm 11
atq
![Removing job 11 from the at queue in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/4cc7c67b0eb98ef53b82b3f93d85bb47.png)
如何查看工作的详细视图 (How to See a Detailed View of Jobs)
As we mentioned previously, you can schedule jobs far into the future. Sometimes, you might forget what a job is going to do. The atq
command shows you the jobs in the queue, but not what they’re going to do. If you want to see a detailed view of a job, you can use the -c
(cat) option.
如前所述,您可以安排将来的工作。 有时,您可能会忘记工作要做的事情。 atq
命令显示队列中的作业,但不显示它们的工作。 如果要查看作业的详细视图,可以使用-c
(cat)选项。
First, we’ll use atq
to find the job number:
首先,我们将使用atq
查找工作编号:
atq
![Output from the "atq" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/f33303d0008b9bbdfcf9806399a56552.png)
Now, we’ll use job number 13 with the -c
option:
现在,我们将作业编号13与-c
选项一起使用:
at -c 13
![The "at -c 13" command and output in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/55a28ef36e286660aa17d89d74ccf0a4.png)
Here’s a breakdown of the information we get back about the job:
以下是我们获得的有关该工作的信息的细分:
First line: This tells us the commands will run under the
sh
shell.第一行:这告诉我们命令将在
sh
shell下运行。Second line: We see the commands will run with both a user and group ID of 1000. These are the values for the person who ran the
at
command.第二行:我们看到命令将同时以用户ID和组ID 1000运行。这是运行
at
命令的人员的值。Third line: The person who receives any emails
at
sends.第三行:谁接收任何邮件的人
at
发送。Fourth line: The User Mask is 22. This is the mask used to set the default permissions for any files created in this
sh
session. The mask is subtracted from 666, which gives us 644 (the octal equivalent ofrw-r--r--
).第四行: “用户掩码”为22。这是用于设置此
sh
会话中创建的任何文件的默认权限的掩码。 从666中减去掩码,得到644(等效于rw-r--r--
的八进制数)。Remaining data: The majority are environment variables.
剩余数据:大多数是环境变量。
![Output from the "-c 13" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/104c2ff227f697eb6e11300128511e94.png)
Results of a test. A test checks to make sure the execution directory can be accessed. If it cannot, an error is raised, and the job execution is abandoned.
测试结果。 测试检查以确保可以访问执行目录。 如果不能,将引发错误,并放弃作业执行。
The commands to be executed. These are listed, and the contents of the scripts that are scheduled are displayed. Note that although the script in our example above was written to run under Bash, it will still be executed in an
sh
shell.要执行的命令。 这些被列出,并显示计划的脚本的内容。 请注意,尽管上面示例中的脚本被编写为在Bash下运行,但仍将在
sh
shell中执行。
批处理命令 (The batch Command)
The batch
command operates similarly to the at
command, but with three significant differences:
batch
命令的操作类似于at
命令,但有三个明显的不同:
You can only use the
batch
command interactively.您只能交互使用
batch
命令。Rather than scheduling jobs to execute at a specific time, you add them to the queue, and the
batch
command executes them when the system’s average load is lower than 1.5.您无需将作业调度为在特定时间执行,而是将其添加到队列中,并且
batch
命令在系统的平均负载低于1.5时执行它们。Due to the above, you never specify a date and time with the
batch
command.由于上述原因,您永远不会使用
batch
命令指定日期和时间。
When you use the batch
command, you call it by name with no command line parameters like so:
使用batch
命令时,可以按名称调用它,而无需使用命令行参数,例如:
batch
![The "batch" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/4d8286972bb982c1a1d85ff1124a543a.png)
Next, add tasks just as you would with the at
command.
接下来,添加任务,就像使用at
命令一样。
控制对at命令的访问 (Controlling Access to the at Command)
The at.allow
and at.deny
files control who can use the at
family of commands. These are located within the /etc
directory. By default, only the at.deny
file exists, and it’s created when at
is installed.
at.allow
和at.deny
文件控制谁可以使用at
系列命令。 它们位于/etc
目录中。 默认情况下,只有at.deny
文件存在,并且是at
安装at
时创建的。
Here’s how these work:
这些是这样工作的:
at.deny
: Lists applications and entities that cannot useat
to schedule jobs.at.deny
:列出无法使用at
计划作业的应用程序和实体。at.allow
: Lists who can useat
to schedule jobs. If theat.allow
file doesn’t exist,at
only uses theat.deny
file.at.allow
:列出谁可以使用at
调度作业。 如果at.allow
文件不存在,则at
仅使用at.deny
文件。
By default, anyone can use at
. If you want to restrict who can use it, use the at.allow
file to list those who can. This is easier than adding everyone who cannot use at
to the at.deny
file.
默认情况下,任何人都可以使用at
。 如果要限制谁可以使用它,请使用at.allow
文件列出可以使用的人。 这比将无法使用at
所有人添加到at.deny
文件at
要容易得多。
Here’s what the at.deny
file looks like:
这是at.deny
文件的样子:
sudo less /etc/at.deny
![The "sudo less /etc/at.deny" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/65a22b5227c8b88e5d081d0755f84ccb.png)
The file lists components of the operating system that cannot use at
. Many of these are prevented from doing so for security reasons, so you don’t want to remove any from the file.
该文件列出了不能at
使用的操作系统组件。 由于安全原因,许多此类文件都被禁止这样做,因此您不想从文件中删除任何文件。
![The contents of the at.deny file in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/10a5c76fa86aa4b522ac27995a34b759.png)
Now, we’ll edit the at.allow
file. We’re going to add dave
and mary
, but no one else will be allowed to use at
.
现在,我们将编辑at.allow
文件。 我们要添加dave
和mary
,但没有人会被允许使用at
。
First, we type the following:
首先,我们键入以下内容:
sudo gedit /etc/at.allow
![The "sudo gedit /etc/at.allow" command in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/8390ca8103f6f6afca36c159e108f93a.png)
In the editor, we add the two names, as shown below, and then save the file.
在编辑器中,我们添加两个名称,如下所示,然后保存文件。
!["dave" and "mary" added to gedit.](https://i-blog.csdnimg.cn/blog_migrate/c2ed11a87f042b126df6cfe501502aed.png)
If anyone else tries to use at
, he’ll be told he doesn’t have permission. For example, let’s say a user named eric
types the following:
如果其他任何人尝试使用at
,则会被告知他没有许可。 例如,假设一个名为eric
的用户键入以下内容:
at
He would be refused, as shown below.
如下所示,他将被拒绝。
!["eric" is refused permission to use "at" in a terminal window.](https://i-blog.csdnimg.cn/blog_migrate/520afb9a6d70173cc67a9588d4c73132.png)
Again, eric
is not in the at.deny
file. As soon as you put anyone in the at.allow
file, any- and everyone else is denied permission to use at
.
同样, eric
不在at.deny
文件中。 将任何人放入at.allow
文件中后, at.allow
和其他所有人都被拒绝使用at
权限。
非常适合一次性 (Great for One-Offs)
As you can see, both at
and batch
are ideal for tasks you only need to run once. Again, as a quick review:
如您所见, at
和batch
都是只需要运行一次的任务的理想选择。 再次,作为快速回顾:
When you need to do something that isn’t a regular process, schedule it with
at
.当你需要做的东西是不是正规的过程,它计划
at
。If you want to run a task only when the system load is low enough, use
batch
.如果只想在系统负载足够低时运行任务,请使用
batch
。
翻译自: https://www.howtogeek.com/451386/how-to-use-at-and-batch-on-linux-to-launch-processes/
linux调度的命令