42

I know that to remove a scheduled at job I have to use atrm "numjob1 numjob2", but is there an easy way to do that for all the jobs?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
robob
  • 584
  • 1
  • 4
  • 12

6 Answers6

43

You can run this command to remove all the jobs at the atq

 for i in `atq | awk '{print $1}'`;do atrm $i;done
pradeepchhetri
  • 9,859
  • 12
  • 51
  • 59
14

You could do something like this:

for i in $(atq | cut -f 1); do atrm $i; done
DaveEmme
  • 386
  • 1
  • 2
  • 5
9

This seems to me a short line:

atrm $(atq | cut -f1)
Nidal
  • 8,856
  • 11
  • 55
  • 74
user78969
  • 91
  • 1
  • 1
2

Here is my xargs version that avoids braces and is hopefully intuitive:

atq | cut -f 1 | xargs atrm

You can also grep specific jobs by timestamp/userid and then remove them:

atq | grep "2018-10-22 16:" | cut -f 1 | xargs atrm
Thyag
  • 971
  • 6
  • 6
2

For more AIX 6 systems you can simply do:

atrm -

Ref: http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds1%2Fatrm.htm

Craig
  • 121
  • 3
0

I had more than 58k jobs in the atd (someone rebooted the server and for some reason atd service not started). Removing the jobs using atrm is very painful for very high queue.

I stopped atd and deleted all dirs from /var/spool/atjobs and files from /var/spool/atspool . For me it worked.

rm -rf /var/spool/atjobs/* ; rm /var/spool/atspool/*
Felipe
  • 1
  • 1
  • You never say anything about starting up `atd` again, and whether that was successful, nor do you mention what Unix this would be an adequate solution for. How did you make sure that other users' jobs were not deleted? – Kusalananda Oct 25 '19 at 12:28
  • Ok! Sorry! Need to start atd after the process. My solution is for "SUSE Linux Enterprise Server 12". But I think it can use in other distributions. I found the information of directories in "man". In my situation, only root is using atd, then removing the files was safe. – Felipe Oct 25 '19 at 12:38