Skip to content

Kill signal not intercepted #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mpoiriert opened this issue May 9, 2016 · 3 comments
Closed

Kill signal not intercepted #26

mpoiriert opened this issue May 9, 2016 · 3 comments

Comments

@mpoiriert
Copy link

mpoiriert commented May 9, 2016

Hi,

I am using your daemon command and I am trying to do a proper shut down on kill signal and it doesn't get intercepted.

If I am kiling the script (CTRL-C) from the current command line is working properly but if I am killing it from another window (with a kill command) my shut down code doesn't get executed. I have override the handleSignal to handle more signal but anyway none of them get handle.

 public function handleSignal($signal)
    {
        switch ($signal) {
            // Shutdown signals
            case SIGTERM:
            case SIGINT:
            case SIGQUIT:
            case SIGKILL:
                $this->shutdown();
                break;
        }
    }
@mac-cain13
Copy link
Owner

Thanks for using this library!

As you can see over here we only handle SIGTERM and SIGINT. SIGINT is send when you hit CTRL-C, SIGTERM is the default when you use kill. There even is a test for handling the termination signal. So it seems a simple kill should work correctly. SIGQUIT doesn't perform any cleanup as described in this GNU document about termination signals.

Are you sure you aren't sending a SIGKILL or SIGQUIT?

If this doesn't solve your problem, could you let me know what command your exactly using on what OS to kill the process?

@mpoiriert
Copy link
Author

I don't know how/what I tested last week it wasn't working...

Testing now and it's working even with tthe SIGKILL (kill processid -9, kill processid -3)...

So anyway everything seems to work.

@mac-cain13
Copy link
Owner

Good to hear it's working! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants