diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2012-01-15 02:10:35 +0100 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2012-01-15 02:10:35 +0100 |
commit | 30a56cdb4680f90e6c371c75c27c6ecec2d7aeec (patch) | |
tree | ff9d19dcc2503bcf3ca7600d7cbad00725b69cdf /src/rc/runscript.c | |
parent | 14625346c07a2a66fe77ce578c9423918bec1d97 (diff) |
Add "ifstopped" command to runscript
Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
Diffstat (limited to 'src/rc/runscript.c')
-rw-r--r-- | src/rc/runscript.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 2f66971c..8e0ced98 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -1079,12 +1079,13 @@ service_plugable(void) } #include "_usage.h" -#define getoptstring "dDsvl:Z" getoptstring_COMMON +#define getoptstring "dDsSvl:Z" getoptstring_COMMON #define extraopts "stop | start | restart | describe | zap" static const struct option longopts[] = { { "debug", 0, NULL, 'd'}, { "dry-run", 0, NULL, 'Z'}, { "ifstarted", 0, NULL, 's'}, + { "ifstopped", 0, NULL, 'S'}, { "nodeps", 0, NULL, 'D'}, { "lockfd", 1, NULL, 'l'}, longopts_COMMON @@ -1093,6 +1094,7 @@ static const char *const longopts_help[] = { "set xtrace when running the script", "show what would be done", "only run commands when started", + "only run commands when stopped", "ignore dependencies", "fd of the exclusive lock from rc", longopts_help_COMMON @@ -1235,6 +1237,10 @@ runscript(int argc, char **argv) if (!(rc_service_state(service) & RC_SERVICE_STARTED)) exit(EXIT_FAILURE); break; + case 'S': + if (!(rc_service_state(service) & RC_SERVICE_STOPPED)) + exit(EXIT_FAILURE); + break; case 'D': deps = false; break; |