Add config option for manually started services

Example:
    service manual:yes [2] /usr/sbin/lighttpd -- HTTP Server

Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
This commit is contained in:
Robert Andersson committed 2018-10-22 12:51:58 +02:00
1 parent 423c8d41a7
commit 6a7f115781
2 files changed
+13

No files matched your search

+7
View File
@@ -672,6 +672,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
int forking = 0;
#endif
int levels = 0;
int manual = 0;
char *line;
char *username = NULL, *log = NULL, *pid = NULL;
char *service = NULL, *proto = NULL, *ifaces = NULL;
@@ -736,6 +737,8 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
pid = cmd;
else if (!strncasecmp(cmd, "name:", 5))
name = cmd;
else if (!strncasecmp(cmd, "manual:yes", 10))
manual = 1;
else if (cmd[0] != '/' && strchr(cmd, '/'))
service = cmd; /* inetd service/proto */
else
@@ -811,6 +814,10 @@ recreate:
free(line);
return errno = ENOMEM;
}
if (type == SVC_TYPE_SERVICE && manual) {
svc_stop(svc);
}
}
#ifdef INETD_ENABLED
else {