(mgr Controller, keyword string)
| 203 | } |
| 204 | |
| 205 | func loadFromPredefined(mgr Controller, keyword string) string { |
| 206 | predefinedMap := map[string][]string{ |
| 207 | "clam": {"clamav-daemon.service", "clamd@scan.service", "clamd"}, |
| 208 | "freshclam": {"clamav-freshclam.service", "freshclam.service"}, |
| 209 | "fail2ban": {"fail2ban.service", "fail2ban"}, |
| 210 | "supervisor": {"supervisord.service", "supervisor.service", "supervisord", "supervisor"}, |
| 211 | "ssh": {"sshd.service", "ssh.service", "sshd", "ssh"}, |
| 212 | "1panel-core": {"1panel-core.service"}, |
| 213 | "1panel-agent": {"1panel-agent.service"}, |
| 214 | "docker": {"docker.service", "dockerd"}, |
| 215 | } |
| 216 | if val, ok := predefinedMap[keyword]; ok { |
| 217 | for _, item := range val { |
| 218 | if exist, _ := mgr.IsExist(item); exist { |
| 219 | return item |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | return "" |
| 224 | } |
| 225 | |
| 226 | // GetServicePath returns the configuration file path for the specified service. |
| 227 | // If serviceName is empty, it returns the default directory path based on the system's service manager. |
no test coverage detected