Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
    You can specify an  exact   date    and time    by  using   HH:MM   MM/DD/YY
format (for example, 16:40 22/12/18 for 4:40 p.m. on December 22,
2018).

When your job is submitted, at reports the job number, date, and time that
the job will be executed; the queue identifier; and the job owner (you). It also
captures all your environment variables and stores them along with the job so
that when your job runs, it can restore the variables, preserving your
execution environment.


The job number and job queue identifier are both important. When you
schedule a job using at, it is placed into queue “a” by default, which means it
runs at your specified time and takes up a normal amount of resources.


An alternative command, batch, is really just a shell script that calls at
with a few extra options. These options (-q b -m now, in case you are
interested) set at to run on queue b (-q b), mail the user on completion (-
m), and run immediately (now). The queue part is what is important: Jobs
scheduled on queue b will only be executed when system load falls below 0.8
—that is, when the system is not running at full load. Furthermore, those jobs
run with a lower niceness, meaning a queue jobs usually have a niceness of 2,
whereas b queue jobs have a niceness of 4.


Because batch always specifies now as its time, you need not specify your
own time; the task will simply run as soon as the system is quiet. Having a
default niceness of 4 means that batched commands get fewer system
resources than a queue job’s (at’s default) and fewer system resources than
with most other programs. You can optionally specify other queues by using
at. Queue c runs at niceness 6, queue d runs at niceness 8, and so on.
However, it is important to note that the system load is only checked before
the command is run. If the load is lower than 0.8, your batch job runs. If the
system load subsequently rises beyond 0.8, your batch job continues to run,
albeit in the background, thanks to its niceness value.


When you submit a job for execution, you are also returned a job number. If
you forget this or just want to see a list of other jobs you have scheduled to
run later, use the atq command with no parameters. If you run this as a
normal user, it prints only your jobs; running it as a super user prints
everyone’s jobs. The output is in the same format as when you submit a job,
so you get the ID number, execution time, queue ID, and owner of each job.


If you want to delete a job, use the atrm command followed by the ID
number of the job you want to delete. This next example shows atq and
atrm being used to list jobs and delete one:

Free download pdf