1

I need to kill all the queued and running jobs on my ID. I have tried

   at -l | awk '{print $1}'| at -r {}

But I keep getting

   {} does not exist

Which leads me to believe that I am parsing the statement wrong.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
mlegge
  • 273
  • 1
  • 5
  • 14

1 Answers1

2

| pipes the output to the standard input of the next command, not to its command line arguments.

To remove all queued jobs, run

at -l | awk '{print $1}'| xargs at -r

alternatively, you can use

at -r  $( at -l | awk '{print $1}' )

$( ... ) is replaced by the output of the commands it contains.

See also this related question.

Please note, that this just removes the jobs from atq, but does not kill running jobs.

If the processes command line matches to a PATTERN and there are no other similar processes running on your username, you can kill them with

pgrep -u $USER PATTERN
jofel
  • 26,513
  • 6
  • 65
  • 92