Remove all `at` jobs

39,464

Solution 1

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

 for i in `atq | awk '{print $1}'`;do atrm $i;done

Solution 2

You could do something like this:

for i in $(atq | cut -f 1); do atrm $i; done

Solution 3

This seems to me a short line:

atrm $(atq | cut -f1)

Solution 4

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

Solution 5

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
Share:
39,464

Related videos on Youtube

robob
Author by

robob

Updated on September 18, 2022

Comments

  • robob
    robob almost 2 years

    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?

  • David Jashi
    David Jashi over 9 years
    In FreeBSD it's cut -f3 First column is date
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy about 9 years
    variation on this answer at -l | awk '{printf "%s ", $1}' | xargs atrm
  • Kusalananda
    Kusalananda over 4 years
    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?
  • Felipe
    Felipe over 4 years
    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.