ntt360 / pmon2

golang进程管理工具(golang process manager)
Apache License 2.0
988 stars 133 forks source link

only stopped process or failed process allow run start 是不是应该在loadFirst判断,而不是restart #22

Open BillXiang opened 3 months ago

BillXiang commented 3 months ago

client/cmd/exec/restart.go

func restart(m *model.Process, flags string) ([]string, error) {
    // only stopped process or failed process allow run start
    if m.Status == model.StatusStopped || m.Status == model.StatusFailed {
        newData, err := reloadProcess(m, flags)
        if err != nil {
            return nil, err
        }

        return newData, nil
    }

    return nil, fmt.Errorf("the process already start")
}