MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / GetScriptName

Function GetScriptName

core/utils/controller/controller.go:298–315  ·  view source on GitHub ↗
(keyword string)

Source from the content-addressed store, hash-verified

296}
297
298func GetScriptName(keyword string) (string, error) {
299 client, err := New()
300 if err != nil {
301 return "", err
302 }
303 switch client.Name() {
304 case "systemd":
305 keyword = strings.TrimSuffix(keyword, ".service") + ".service"
306 case "openrc", "sysvinit":
307 lastDotIdx := strings.LastIndex(keyword, ".")
308 if lastDotIdx != -1 {
309 keyword = keyword[:lastDotIdx]
310 }
311 default:
312 return "", fmt.Errorf("unsupported manager: %s", client.Name())
313 }
314 return keyword, nil
315}

Callers

nothing calls this directly

Calls 2

NewFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected