xenon icon indicating copy to clipboard operation
xenon copied to clipboard

[feature] refactor function isMysqldRunning()

Open hustjieke opened this issue 3 years ago • 0 comments

Now xenon check the mysqld_safe --defaults-file=[] process is running by bash, if mysql and xenon are not in the same machine, how can it work? Maybe we can use ping() better ?

// check the mysqld_safe --defaults-file=[] process is running.
func (m *Mysqld) isMysqldRunning() bool {
        log := m.log

        args := m.argsHandler.IsRunning()
        outs, err := m.cmd.RunCommand(bash, args)
        if err != nil {
                log.Error("mysqld57.isMysqldRunning.error[%v:%+v]", outs, err)
                return false
        }       
        running, err := strconv.Atoi(strings.TrimSpace(outs))
        if err != nil { 
                log.Error("isMysqldRunning.error[%+v]", err)
                return true
        }       
        return (running > 0)
}       

hustjieke avatar Mar 31 '21 13:03 hustjieke