mirror of
https://github.com/troglobit/finit.git
synced 2026-11-15 19:13:11 +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:
1 parent
423c8d41a7
commit
6a7f115781
2 files changed
+13
No files matched your search
@@ -185,6 +185,12 @@ Syntax
|
|||||||
For a detailed description of conditions, and how to debug them, see
|
For a detailed description of conditions, and how to debug them, see
|
||||||
the [Finit Conditions](conditions.md) document.
|
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
|
The name of a service, shown by the `initctl` tool, defaults to the
|
||||||
basename of the service executable. It can be changed with the
|
basename of the service executable. It can be changed with the
|
||||||
optional `name` argument:
|
optional `name` argument:
|
||||||
|
|||||||
@@ -672,6 +672,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
int forking = 0;
|
int forking = 0;
|
||||||
#endif
|
#endif
|
||||||
int levels = 0;
|
int levels = 0;
|
||||||
|
int manual = 0;
|
||||||
char *line;
|
char *line;
|
||||||
char *username = NULL, *log = NULL, *pid = NULL;
|
char *username = NULL, *log = NULL, *pid = NULL;
|
||||||
char *service = NULL, *proto = NULL, *ifaces = 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;
|
pid = cmd;
|
||||||
else if (!strncasecmp(cmd, "name:", 5))
|
else if (!strncasecmp(cmd, "name:", 5))
|
||||||
name = cmd;
|
name = cmd;
|
||||||
|
else if (!strncasecmp(cmd, "manual:yes", 10))
|
||||||
|
manual = 1;
|
||||||
else if (cmd[0] != '/' && strchr(cmd, '/'))
|
else if (cmd[0] != '/' && strchr(cmd, '/'))
|
||||||
service = cmd; /* inetd service/proto */
|
service = cmd; /* inetd service/proto */
|
||||||
else
|
else
|
||||||
@@ -811,6 +814,10 @@ recreate:
|
|||||||
free(line);
|
free(line);
|
||||||
return errno = ENOMEM;
|
return errno = ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == SVC_TYPE_SERVICE && manual) {
|
||||||
|
svc_stop(svc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef INETD_ENABLED
|
#ifdef INETD_ENABLED
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in new issue
Block a user