0

I'm working with ash/dash and try to kill a subprocess - which doesn't seem to respond:

sh & opens a subprocess and jobs delivers [1]+ Stopped (tty Input) sh.

But trying to kill this Job with kill %1 or kill 26672 doesn't work. jobs delivers [1]+ Stopped (tty Input) sh again.

After putting the job to foreground with fg opens the shell for input. Neither ctrl+c nor ctrl+z are working but I can kill the process with exit or kill -SIGKILL $$ respectively stop/suspend the process with kill -STOP $$ (there is no suspend-command in ash).

On the other hand - doing this with i.e. sleep 100 works fine till I fg and stop the process with ctr+z. Then I'm not able to kill this stopped job.

So what am I missing and what could be the solution to kill a stopped job? Do I have to deal with set -m and how?

Thanks in advance.

deetee
  • 75
  • 1
  • 7

2 Answers2

2

You can try

kill -9 $(jobs -p)

Or, just do exit command to logout, it will automatically killed the stopped jobs

Ashiq Imran
  • 2,077
  • 19
  • 17
0

You can rung the Stopped process by kill -SIGCONT %numberand also if you need to kill that process you can kill it by kill -SIGTERM %number.Try this I think this will help you.

Sanjaya
  • 156
  • 1
  • 9
  • Thanks for the hint to the solution. Actually `kill -SIGKILL %1` or `kill -KILL %1` did (killed) the job. In the case of using ash the second command worked. To see the possible signals a shell supports the command `kill -l` helps. Instead of `-SIGKILL` or `-KILL` also `-9` can be used. By the way: `SIGTERM`didn't kill the job. – deetee Feb 21 '16 at 16:51