@expose(hide=True)
    def default(self):
        """Default function of debug"""
        # self.start = True
        self.interactive = False
        self.msg = []
        self.trigger_nginx = False
        self.trigger_php = False

        if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7)
           and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql)
           and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
           and (not self.app.pargs.all)
           and (not self.app.pargs.site_name)
           and (not self.app.pargs.import_slow_log)
           and (not self.app.pargs.interval)):
            if self.app.pargs.stop or self.app.pargs.start:
                print("--start/stop option is deprecated since ee3.0.5")
                self.app.args.print_help()
            else:
                self.app.args.print_help()

        if self.app.pargs.import_slow_log:
            self.import_slow_log()

        if self.app.pargs.interval:
            try:
                cron_time = int(self.app.pargs.interval)
            except Exception as e:
                cron_time = 5

            try:
                if not EEShellExec.cmd_exec(self, "crontab -l | grep "
                                            "'ee debug --import-slow-log'"):
                    if not cron_time == 0:
                        Log.info(self, "setting up crontab entry,"
                                 " please wait...")
                        EEShellExec.cmd_exec(self, "/bin/bash -c \"crontab -l "
                                             "2> /dev/null | {{ cat; echo -e"
                                             " \\\"#EasyEngine start MySQL "
                                             "slow log \\n*/{0} * * * * "
                                             "/usr/local/bin/ee debug"
                                             " --import-slow-log\\n"
                                             "#EasyEngine end MySQL slow log"
                                             "\\\"; }} | crontab -\""
                                             .format(cron_time))
                else:
                    if not cron_time == 0:
                        Log.info(self, "updating crontab entry,"
                                 " please wait...")
                        if not EEShellExec.cmd_exec(self, "/bin/bash -c "
                                                    "\"crontab "
                                                    "-l | sed '/EasyEngine "
                                                    "start MySQL slow "
                                                    "log/!b;n;c\*\/{0} "
                                                    "\* \* \* "
                                                    "\* \/usr"
                                                    "\/local\/bin\/ee debug "
                                                    "--import\-slow\-log' "
                                                    "| crontab -\""
                                                    .format(cron_time)):
                            Log.error(self, "failed to update crontab entry")
                    else:
                        Log.info(self, "removing crontab entry,"
                                 " please wait...")
                        if not EEShellExec.cmd_exec(self, "/bin/bash -c "
                                                    "\"crontab "
                                                    "-l | sed '/EasyEngine "
                                                    "start MySQL slow "
                                                    "log/,+2d'"
                                                    "| crontab -\""
                                                    .format(cron_time)):
                            Log.error(self, "failed to remove crontab entry")
            except CommandExecutionError as e:
                Log.debug(self, str(e))

        if self.app.pargs.all == 'on':
            if self.app.pargs.site_name:
                self.app.pargs.wp = 'on'
            self.app.pargs.nginx = 'on'
            self.app.pargs.php = 'on'
            self.app.pargs.fpm = 'on'
            if EEVariables.ee_platform_codename == 'trusty' and EEAptGet.is_installed(self,'php7.0-fpm'):
                self.app.pargs.php7 = 'on'
                self.app.pargs.fpm7 = 'on'
            self.app.pargs.mysql = 'on'
            self.app.pargs.rewrite = 'on'

        if self.app.pargs.all == 'off':
            if self.app.pargs.site_name:
                self.app.pargs.wp = 'off'
            self.app.pargs.nginx = 'off'
            self.app.pargs.php = 'off'
            self.app.pargs.fpm = 'off'
            if EEVariables.ee_platform_codename == 'trusty' and EEAptGet.is_installed(self,'php7.0-fpm'):
                self.app.pargs.php7 = 'off'
                self.app.pargs.fpm7 = 'off'
            self.app.pargs.mysql = 'off'
            self.app.pargs.rewrite = 'off'

        if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7)
           and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql)
           and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
           and self.app.pargs.site_name):
            self.app.args.print_help()
            # self.app.pargs.nginx = 'on'
            # self.app.pargs.wp = 'on'
            # self.app.pargs.rewrite = 'on'

        if self.app.pargs.nginx:
            self.debug_nginx()
        if self.app.pargs.php:
            self.debug_php()
        if self.app.pargs.fpm:
            self.debug_fpm()
        if self.app.pargs.php7:
            self.debug_php7()
        if self.app.pargs.fpm7:
            self.debug_fpm7()
        if self.app.pargs.mysql:
            # MySQL debug will not work for remote MySQL
            if EEVariables.ee_mysql_host is "localhost":
                self.debug_mysql()
            else:
                Log.warn(self, "Remote MySQL found, EasyEngine will not "
                         "enable remote debug")
        if self.app.pargs.wp:
            self.debug_wp()
        if self.app.pargs.rewrite:
            self.debug_rewrite()

        if self.app.pargs.interactive:
            self.interactive = True

        # Reload Nginx
        if self.trigger_nginx:
            EEService.reload_service(self, 'nginx')
        # Reload PHP
        if self.trigger_php:
            if EEVariables.ee_platform_codename == 'trusty':
                if EEAptGet.is_installed(self,'php5.6-fpm'):
                    EEService.restart_service(self, 'php5.6-fpm')
                if EEAptGet.is_installed(self,'php7.0-fpm'):
                    EEService.restart_service(self, 'php7.0-fpm')
            else:
                EEService.restart_service(self, 'php5-fpm')

        if len(self.msg) > 0:
            if not self.app.pargs.interactive:
                disp_msg = ' '.join(self.msg)
                Log.info(self, "Use following command to check debug logs:\n"
                         + Log.ENDC + "tail -f {0}".format(disp_msg))
            else:
                signal.signal(signal.SIGINT, self.signal_handler)
                watch_list = []
                for w_list in self.msg:
                    watch_list = watch_list + glob.glob(w_list)

                logwatch(self, watch_list)
dataset/ETHPy150Open EasyEngine/easyengine/ee/cli/plugins/debug.py/EEDebugController.default/original