mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-18 22:22:59 +08:00
feat: 修改 Supervisor 的判断 (#1876)
This commit is contained in:
parent
0e8a4eaf2e
commit
381233a8a5
@ -43,11 +43,17 @@ func (h *HostToolService) GetToolStatus(req request.HostToolReq) (*response.Host
|
||||
res.Type = req.Type
|
||||
switch req.Type {
|
||||
case constant.Supervisord:
|
||||
exist, _ := systemctl.IsExist(constant.Supervisord)
|
||||
supervisorConfig := &response.Supervisor{}
|
||||
if !exist {
|
||||
exist, _ = systemctl.IsExist(constant.Supervisor)
|
||||
if !exist {
|
||||
if !cmd.Which(constant.Supervisord) {
|
||||
supervisorConfig.IsExist = false
|
||||
res.Config = supervisorConfig
|
||||
return res, nil
|
||||
}
|
||||
supervisorConfig.IsExist = true
|
||||
serviceExist, _ := systemctl.IsExist(constant.Supervisord)
|
||||
if !serviceExist {
|
||||
serviceExist, _ = systemctl.IsExist(constant.Supervisor)
|
||||
if !serviceExist {
|
||||
supervisorConfig.IsExist = false
|
||||
res.Config = supervisorConfig
|
||||
return res, nil
|
||||
@ -57,7 +63,6 @@ func (h *HostToolService) GetToolStatus(req request.HostToolReq) (*response.Host
|
||||
} else {
|
||||
supervisorConfig.ServiceName = constant.Supervisord
|
||||
}
|
||||
supervisorConfig.IsExist = true
|
||||
|
||||
serviceNameSet, _ := settingRepo.Get(settingRepo.WithByKey(constant.SupervisorServiceName))
|
||||
if serviceNameSet.ID != 0 || serviceNameSet.Value != "" {
|
||||
|
@ -168,3 +168,8 @@ func SudoHandleCmd() string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func Which(name string) bool {
|
||||
_, err := exec.LookPath(name)
|
||||
return err == nil
|
||||
}
|
||||
|
@ -46,15 +46,6 @@ func Restart(serviceName string) error {
|
||||
out, err := RunSystemCtl("restart", serviceName)
|
||||
return handlerErr(out, err)
|
||||
}
|
||||
func Start(serviceName string) error {
|
||||
out, err := RunSystemCtl("start", serviceName)
|
||||
return handlerErr(out, err)
|
||||
}
|
||||
|
||||
func Stop(serviceName string) error {
|
||||
out, err := RunSystemCtl("stop", serviceName)
|
||||
return handlerErr(out, err)
|
||||
}
|
||||
|
||||
func Operate(operate, serviceName string) error {
|
||||
out, err := RunSystemCtl(operate, serviceName)
|
||||
|
@ -65,7 +65,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||
serviceName: data.value.serviceName,
|
||||
})
|
||||
.then(() => {
|
||||
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
|
||||
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
|
@ -8,7 +8,7 @@
|
||||
{{ $t('website.log') }}
|
||||
</el-button>
|
||||
<el-button type="primary" :plain="activeName !== '3'" @click="changeTab('3')">
|
||||
{{ $t('website.basic') }}
|
||||
{{ $t('commons.button.init') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template #main>
|
||||
|
Loading…
Reference in New Issue
Block a user