rc-service: add -d/--debug and -D/--nodeps options
This commit is contained in:
parent
958f57d895
commit
4d47ce440c
@ -20,6 +20,14 @@
|
|||||||
.Ar service cmd
|
.Ar service cmd
|
||||||
.Op Ar ...
|
.Op Ar ...
|
||||||
.Nm
|
.Nm
|
||||||
|
.Fl d , -debug
|
||||||
|
.Ar service cmd
|
||||||
|
.Op Ar ...
|
||||||
|
.Nm
|
||||||
|
.Fl D , -nodeps
|
||||||
|
.Ar service cmd
|
||||||
|
.Op Ar ...
|
||||||
|
.Nm
|
||||||
.Op Fl i , -ifexists
|
.Op Fl i , -ifexists
|
||||||
.Ar service cmd
|
.Ar service cmd
|
||||||
.Op Ar ...
|
.Op Ar ...
|
||||||
@ -72,6 +80,12 @@ otherwise -1.
|
|||||||
.Fl r , -resolve
|
.Fl r , -resolve
|
||||||
does the same and also prints the full path of the service to stdout.
|
does the same and also prints the full path of the service to stdout.
|
||||||
.Pp
|
.Pp
|
||||||
|
.Fl d , -debug
|
||||||
|
sets -x when running the service script(s).
|
||||||
|
.Pp
|
||||||
|
.Fl D , -nodeps
|
||||||
|
ignores dependencies when running the service.
|
||||||
|
.Pp
|
||||||
.Fl Z , -dry-run
|
.Fl Z , -dry-run
|
||||||
prints out the commands it would execute rather than executing them.
|
prints out the commands it would execute rather than executing them.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
|
|
||||||
const char *applet = NULL;
|
const char *applet = NULL;
|
||||||
const char *extraopts = NULL;
|
const char *extraopts = NULL;
|
||||||
const char *getoptstring = "ce:ilr:INZ" getoptstring_COMMON;
|
const char *getoptstring = "cdDe:ilr:INZ" getoptstring_COMMON;
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
|
{ "debug", 0, NULL, 'd' },
|
||||||
|
{ "nodeps", 0, NULL, 'D' },
|
||||||
{ "exists", 1, NULL, 'e' },
|
{ "exists", 1, NULL, 'e' },
|
||||||
{ "ifcrashed", 0, NULL, 'c' },
|
{ "ifcrashed", 0, NULL, 'c' },
|
||||||
{ "ifexists", 0, NULL, 'i' },
|
{ "ifexists", 0, NULL, 'i' },
|
||||||
@ -42,6 +44,8 @@ const struct option longopts[] = {
|
|||||||
longopts_COMMON
|
longopts_COMMON
|
||||||
};
|
};
|
||||||
const char * const longopts_help[] = {
|
const char * const longopts_help[] = {
|
||||||
|
"set xtrace when running the command",
|
||||||
|
"ignore dependencies",
|
||||||
"tests if the service exists or not",
|
"tests if the service exists or not",
|
||||||
"if the service is crashed then run the command",
|
"if the service is crashed then run the command",
|
||||||
"if the service exists then run the command",
|
"if the service exists then run the command",
|
||||||
@ -78,6 +82,12 @@ int main(int argc, char **argv)
|
|||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case 'd':
|
||||||
|
setenv("RC_DEBUG", "yes", 1);
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
setenv("RC_NODEPS", "yes", 1);
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
service = rc_service_resolve(optarg);
|
service = rc_service_resolve(optarg);
|
||||||
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;
|
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user