Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

Click here to view code image
matthew@seymour:~$ atq
14 2012-01-20 23:33 a matthew
16 2012-02-03 22:34 a matthew
17 2012-01-25 22:34 a matthew
15 2012-01-22 04:34 a matthew
18 2012-01-22 01:35 b matthew
matthew@seymour:~$ atrm 16
matthew@seymour:~$ atq
14 2012-01-20 23:33 a matthew
17 2012-01-25 22:34 a matthew
15 2012-01-22 04:34 a matthew
18 2012-01-22 01:35 b matthew


In this example, job 16 is deleted using atrm, and so it does not show up in
the second call to atq.


The default configuration for at and batch is to allow everyone to use it,
which is not always the desired behavior. Access is controlled through two
files: /etc/at.allow and /etc/at.deny. By default, at.deny exists
but is empty, which allows everyone to use at and batch. You can enter
usernames into at.deny, one per line, to stop those users from scheduling
jobs.


Alternatively, you can use the at.allow file; this does not exist by default.
If you have a blank at.allow file, no one except root is allowed to
schedule jobs. As with at.deny, you can add usernames to at.allow, one
per line, and those users are able to schedule jobs. You should use either
at.deny or at.allow: When someone tries to run at or batch, Ubuntu
checks for her username in at.allow. If it is in there, or if at.allow does
not exist, Ubuntu checks for her username in at.deny. If her username is in
at.deny or if at.deny does not exist, the user is not allowed to schedule
jobs.


Using cron to Run Jobs Repeatedly


The at and batch commands work well if you just want to execute a single
task at a later date, but they are less useful if you want to run a task
frequently. Instead, the cron daemon exists for running tasks repeatedly
based on system (and user) requests. The cron daemon has a similar
permissions system to at: Users listed in the cron.deny file are not
allowed to use cron, and users listed in the cron.allow file are. An
empty cron.deny file—the default—means everyone can set jobs. An

Free download pdf