matar una variedad de trabajos por jobspec

I can't find an answer to this other than get the jobspec and then kill %jobspec...

I have 46 jobs in the background of a tape backup robot which I submitted in a loop which are all stuck because of this error Suspended (tty output) which I've since found out means that I needed to enter my password before the process was sent to the background otherwise it won't start.

Esto es lo que quiero hacer kill %[1-46] but I have no idea if it will work as I expect. There seems to be no reference to killing a range of jobs like this anywhere (at least that I've looked in, like the internet...).

Cualquier ayuda sería muy apreciada :)



preguntado el 12 de junio de 14 a las 10:06

1 Respuestas

One option is to loop over the jobs. E.g. In bash it looks like:

for i in {1..3}; do kill %$i; done


$ for i in {1..3}; do sleep 20 & done
[1] 26453
[2] 26454
[3] 26455
$ jobs
[1]   Running                 sleep 20 &
[2]-  Running                 sleep 20 &
[3]+  Running                 sleep 20 &
$ for i in {1..3}; do kill %$i; done
$ jobs
[1]   Terminated              sleep 20
[2]-  Terminated              sleep 20
[3]+  Terminated              sleep 20
$ jobs

respondido 08 mar '18, 06:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.