start page | rating of books | rating of authors | reviews | copyrights

Unix Power ToolsUnix Power ToolsSearch this book

25.7. Checking and Removing Jobs

From time to time, you'll submit an at job and realize that there's something wrong with it. How do you get it out of the queue? Two tools help you do this: atq, which reports the jobs that are in the queue, and atrm, which deletes jobs that are already in the queue.

atq is pretty simple; by default, it reports on all jobs that have been queued. Optionally, you can give it a user name as an argument; in this case it reports all the jobs queued by the given user. The report looks like this:

los% atq
 Rank     Execution Date     Owner     Job #   Queue   Job Name
  1st   Oct  9, 1996 22:27   mikel      4637       a   stdin
  2nd   Oct 10, 1996 01:08   mikel      4641       a   stdin
  3rd   Oct 10, 1996 02:34   judy       4663       a   stdin

Note that atq has no objection to telling you about other users' jobs. Although this might seem like a security hole, it's actually useful -- see Section 25.8. The jobs are ordered according to their execution date. With the -c option, atq orders jobs according to when they were queued -- conceivably a useful feature. (atq -n just prints the number of jobs that are queued; I'm not sure when this would be useful.)

Once you've found out the job number, you can delete it with the command atrm. You can only delete your own jobs, not someone else's:

% atrm 4637
4637: removed
% atrm 4663
4663: permission denied

The command atrm - removes all the jobs you submitted; it's good for cleaning out your queue completely.

NOTE: On some versions, use at -l to list your jobs (instead of atq) and at -r to delete your jobs (instead of atrm). Other systems may have different commands and options; check your manpage.

Some older BSD-based implementations may not support any of these options. Once you submit a job, you can delete it by finding its filename in the /usr/spool/at directory and emptying the file (Section 15.2). Or the superuser (Section 1.18) can go to the spool directory and delete the file by hand.

-- ML



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.