Shuts down the daemon process.

def shutdown(self):
        """ Shuts down the daemon process.
            """

        if not self._exited:
            self._exited = True

            # signal task runner to terminate via SIGTERM
            if self._task_runner.is_alive():
                self._task_runner.terminate()

                # if command server is running, then block until
                # task runner completes so it has time to use
                # the command server to clean up root plugins
                if self._command_server.is_alive():
                    if self._task_runner.is_alive():
                        self._task_runner.join()

            _shutdown_pipe(self._pipe)
            self._task.stop()