mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 修改 ssh 开启自启状态判断 (#2851)
This commit is contained in:
parent
01f5c868b7
commit
7082e2fa43
@ -68,7 +68,18 @@ func (u *SSHService) GetSSHInfo() (*dto.SSHInfo, error) {
|
||||
data.Status = constant.StatusEnable
|
||||
}
|
||||
}
|
||||
data.AutoStart, _ = systemctl.IsEnable(serviceName)
|
||||
|
||||
out, err := systemctl.RunSystemCtl("is-enabled", serviceName)
|
||||
if err != nil {
|
||||
data.AutoStart = false
|
||||
} else {
|
||||
if out == "alias\n" {
|
||||
data.AutoStart, _ = systemctl.IsEnable("ssh")
|
||||
} else {
|
||||
data.AutoStart = out == "enabled\n"
|
||||
}
|
||||
}
|
||||
|
||||
sshConf, err := os.ReadFile(sshPath)
|
||||
if err != nil {
|
||||
data.Message = err.Error()
|
||||
|
Loading…
x
Reference in New Issue
Block a user