How to Display the at Queue
To check your jobs that are waiting in the at queue, use the atq command. This command displays status information about the at jobs that you created.
$ atq |
How to Verify an at Job
To verify that you have created an at job, use the atq command. The atq command confirms that at jobs that belong to jones have been submitted to the queue.
$ atq Rank Execution Date Owner Job Queue Job Name 1st Jul 12, 2001 19:30 jones 897355800.a a stdin 2nd Jul 14, 2001 23:45 jones 897543900.a a stdin 3rd Jul 17, 2001 04:00 jones 897732000.a a stdin |
How to Display at Jobs
To display information about the execution times of your at jobs, use the at -l command.
$ at -l [job-id] |
Where the -l job-id option identifies the identification number of the job whose status you want to display.
Example--Displaying at Jobs
The following example shows output from the at -l command, which provides status information on all jobs submitted by a user.
$ at -l 897543900.a Sat Jul 14 23:45:00 2001 897355800.a Thu Jul 12 19:30:00 2001 897732000.a Tue Jul 17 04:00:00 2001 |
The following example shows the output displayed when a single job is specified with the at -l command.
$ at -l 897732000.a 897732000.a Tue Jul 17 04:00:00 2001 |
How to Remove at Jobs
(Optional) Become superuser to remove an at job that belongs to root or another user.
Remove the at job from the queue before the job is executed.
$ at -r [job-id]
Where the -r job-id option specifies the identification number of the job you want to remove.
Verify that the at job is removed by using the at -l (or the atq) command.
The at -l command displays the jobs remaining in the at queue. The job whose identification number you specified should not appear.
$ at -l [job-id]
Example--Removing at Jobs
In the following example, a user wants to remove an at job that was scheduled to execute at 4 a.m. on July 17th. First, the user displays the at queue to locate the job identification number. Next, the user removes this job from the at queue. Finally, the user verifies that this job has been removed from the queue.
$ at -l 897543900.a Sat Jul 14 23:45:00 2001 897355800.a Thu Jul 12 19:30:00 2001 897732000.a Tue Jul 17 04:00:00 2001 $ at -r 897732000.a $ at -l 897732000.a at: 858142000.a: No such file or directory |
How to Deny Access to the at Command
Become superuser.
Edit the /etc/cron.d/at.deny file and add the names of users, one per line, that will be prevented from using at commands.
daemon bin smtp nuucp listen nobody noaccess username1 username2 username3 . . .
Example--Denying at Access
The following example shows an at.deny file that has been edited so that the users smith and jones cannot access the at command.
$ cat at.deny daemon bin smtp nuucp listen nobody noaccess jones smith |
How to Verify that at Access Is Denied
To verify that a username was added correctly to /etc/cron.d/at.deny, use the at -l command while logged in as the user. If the user cannot access the at command, the following message is displayed.
# su smith Password: $ at -l at: you are not authorized to use at. Sorry. |
Likewise, if the user tries to submit an at job, the following message is displayed:
$ at 2:30pm at: you are not authorized to use at. Sorry. |
This message confirms that the user is listed in the at.deny file.
If at access is allowed, the at -l command returns nothing.