37

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?

35

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

 for i in `atq | awk '{print $1}'`;do atrm $i;done
| improve this answer | |
  • 2
    variation on this answer at -l | awk '{printf "%s ", $1}' | xargs atrm – Sergiy Kolodyazhnyy Apr 24 '15 at 10:11
13

You could do something like this:

for i in $(atq | cut -f 1); do atrm $i; done
| improve this answer | |
  • In FreeBSD it's cut -f3 First column is date – David Jashi Oct 26 '14 at 9:51
7

This seems to me a short line:

atrm $(atq | cut -f1)
| improve this answer | |
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

| improve this answer | |
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
| improve this answer | |
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/*
| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.