Note: Before you mark this question as duplicate, please note that I've tried all the solutions that I could get online, but still I'm unable to resolve the problem.

I ran daemon through the following command:

rake resque:work QUEUE='*' &

It returned me 13031. Now, I want to kill this daemon, and I've trying the following commands:

kill -9 13031
kill 13031

Running both commands says: -bash: kill: (13031) - No such process, and now I'm stuck. I'm unable to figure out how to kill the daemon.

  • 2
    pgrep for the daemon? – Reuben L. Jun 25 '16 at 12:21
  • What about to pkill -9 rake or to kill the ruby instance of rake? – Hastur Jun 30 '16 at 13:54

I have a possible theory for this.

When you run the application as

$ rake resque:work QUEUE='*' &
[1] 13031

The application internally does a fork+exit, to run in background.

C code equivalent of that would be:

if(fork()) exit(0);

So, the process with PID==13031 will spawn a child process & exit itself. The child will keep running in background & will be inherited by the init process (PID==1).
You can see if this is the case, press another enter key after starting the rake command. Do you see prints like this?

[1]+  Done                 rake resque:work QUEUE='*'

Try running ps in terminal. That should show the child process PID. If you kill that, the daemon should exit.

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.