static void msg_start(const char *name) { struct service *svc; char *tmp = NULL; char *args = NULL; if (!strchr(name, ':')) svc = service_find_by_name(name); else { tmp = strdup(name); args = strchr(tmp, ':'); *args = '\0'; args++; svc = service_find_by_name(tmp); } if (svc) { service_start(svc, args); } else { ERROR("no such service '%s'\n", name); } if (tmp) free(tmp); }
int do_stop(int nargs, char **args) { struct service *svc; svc = service_find_by_name(args[1]); if (svc) { service_stop(svc); } return 0; }
static void msg_stop(const char *name) { struct service *svc = service_find_by_name(name); if (svc) { service_stop(svc); } else { ERROR("no such service '%s'\n", name); } }
int do_enable(int nargs, char **args) { struct service *svc; svc = service_find_by_name(args[1]); if (svc) { svc->flags &= ~(SVC_DISABLED | SVC_RC_DISABLED); if (svc->flags & SVC_DISABLED_START) { service_start(svc, NULL); } } else { return -1; } return 0; }