home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 40.8 Automatically Restarting at Jobs Chapter 40
Delayed Execution
Next: 40.10 nextday, nextweekday: Tomorrow or Next Weekday

40.9 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 article 40.5 . 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 System V prior to SVR4, use at -l to list your jobs (instead of atq ), and at -r to delete your jobs (instead of atrm ). SunOS and SVR4 support both versions.

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 (24.1 ) . Or the superuser (1.24 ) can go to the spool directory and delete the file by hand.

- ML

Previous: 40.8 Automatically Restarting at Jobs UNIX Power Tools Next: 40.10 nextday, nextweekday: Tomorrow or Next Weekday
40.8 Automatically Restarting at Jobs Book Index 40.10 nextday, nextweekday: Tomorrow or Next Weekday

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System