'Shut down SickRage
:param event: Type of shutdown event, used to see if restart required'

def shutdown(self, event):

    if sickbeard.started:
        sickbeard.halt()
        sickbeard.saveAll()
        if self.web_server:
            logger.log(u'Shutting    down    Tornado')
            self.web_server.shutdown()
            try:
                self.web_server.join(10)
            except Exception:
                pass
        self.clear_cache()
        if (self.run_as_daemon and self.create_pid):
            self.remove_pid_file(self.pid_file)
        if (event == sickbeard.event_queue.Events.SystemEvent.RESTART):
            install_type = sickbeard.versionCheckScheduler.action.install_type
            popen_list = []
            if (install_type in (u'git', u'source')):
                popen_list = [sys.executable, sickbeard.MY_FULLNAME]
            elif (install_type == u'win'):
                logger.log(u'You    are    using    a    binary    Windows    build    of    SickRage.    Please    switch    to    using    git.', logger.ERROR)
            if (popen_list and (not sickbeard.NO_RESTART)):
                popen_list += sickbeard.MY_ARGS
                if (u'--nolaunch' not in popen_list):
                    popen_list += [u'--nolaunch']
                logger.log(u'Restarting    SickRage    with    {options}'.format(options=popen_list))
                logger.shutdown()
                subprocess.Popen(popen_list, cwd=os.getcwd())
    logger.shutdown()
    os._exit(0)
