public static function signal_handler($signo) {
        // Note: There is no need to manually call the shutdown handler.
        // The fact that we are calling exit() in this script means that the standard shutdown handling is performed
        // anyway.
        switch ($signo) {
            case SIGTERM:
                // Replicate native behaviour.
                echo "Terminated: {$signo}\n";

                // The standard exit code for SIGTERM is 143.
                $exitcode = 143;
                break;
            case SIGINT:
                // Replicate native behaviour.
                echo "\n";

                // The standard exit code for SIGINT (Ctrl+C) is 130.
                $exitcode = 130;
                break;
            default:
                // The signal handler was called with a signal it was not expecting.
                // We should exit and complain.
                echo "Warning: \core_shutdown_manager::signal_handler() was called with an unexpected signal ({$signo}).\n";
                $exitcode = 1;
        }

        exit ($exitcode);
    }
public static function signal_handler($signo) {
        // Note: There is no need to manually call the shutdown handler.
        // The fact that we are calling exit() in this script means that the standard shutdown handling is performed
        // anyway.
        switch ($signo) {
            case SIGTERM:
                // Replicate native behaviour.
                echo "Terminated: {$signo}\n";

                // The standard exit code for SIGTERM is 143.
                $exitcode = 143;
                break;
            case SIGINT:
                // Replicate native behaviour.
                echo "\n";

                // The standard exit code for SIGINT (Ctrl+C) is 130.
                $exitcode = 130;
                break;
            default:
                // The signal handler was called with a signal it was not expecting.
                // We should exit and complain.
                echo "Warning: \core_shutdown_manager::signal_handler() was called with an unexpected signal ({$signo}).\n";
                $exitcode = 1;
        }

        exit ($exitcode);
    }
public static function signal_handler ( $ signo ) { // Note: There is no need to manually call the shutdown handler. // The fact that we are calling exit() in this script means that the standard shutdown handling is performed // anyway. switch ( $ signo ) { case SIGTERM : // Replicate native behaviour. echo "Terminated: {$signo}\n" ; // The standard exit code for SIGTERM is 143. $ exitcode = 143 ; break ; case SIGINT : // Replicate native behaviour. echo "\n" ; // The standard exit code for SIGINT (Ctrl+C) is 130. $ exitcode = 130 ; break ; default : // The signal handler was called with a signal it was not expecting. // We should exit and complain. echo "Warning: \core_shutdown_manager::signal_handler() was called with an unexpected signal ({$signo}).\n" ; $ exitcode = 1 ; } exit ( $ exitcode ) ; }
Signal handler for SIGINT, and SIGTERM.

@param   int     $signo The signal being handled
Signal handler for SIGINT and SIGTERM .