mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
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:
@@ -185,6 +185,12 @@ Syntax
|
||||
For a detailed description of conditions, and how to debug them, see
|
||||
the [Finit Conditions](conditions.md) document.
|
||||
|
||||
If a service should not be automatically started, it can be configured
|
||||
as manual with the optional `manual` argument. The service can then be
|
||||
started at any time by running `initctl start <service>`.
|
||||
|
||||
manual:yes
|
||||
|
||||
The name of a service, shown by the `initctl` tool, defaults to the
|
||||
basename of the service executable. It can be changed with the
|
||||
optional `name` argument:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user