Skip to content

Commit fb92968

Browse files
authored
fix: Fix the issue of abnormal sshd service auto-start status (#11022)
Refs #11017
1 parent bddcf76 commit fb92968

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agent/utils/controller/manager/systemd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func (s *Systemd) IsActive(serviceName string) (bool, error) {
2626

2727
func (s *Systemd) IsEnable(serviceName string) (bool, error) {
2828
out, err := run(s.toolCmd, "is-enabled", serviceName)
29+
if out == "alias\n" && serviceName == "sshd.service" {
30+
return s.IsEnable("ssh")
31+
}
2932
if err != nil && out != "disabled\n" {
30-
if serviceName == "sshd" && out == "alias\n" {
31-
return s.IsEnable("ssh")
32-
}
3333
if NewSnap().IsEnable(serviceName) {
3434
return true, nil
3535
}

0 commit comments

Comments
 (0)