From: "Christian Ruppert" <idl0r@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: man/, src/rc/
Date: Sun, 15 Jan 2012 01:11:21 +0000 (UTC) [thread overview]
Message-ID: <30a56cdb4680f90e6c371c75c27c6ecec2d7aeec.idl0r@gentoo> (raw)
commit: 30a56cdb4680f90e6c371c75c27c6ecec2d7aeec
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 15 01:10:35 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sun Jan 15 01:10:35 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=30a56cdb
Add "ifstopped" command to runscript
Signed-off-by: Christian Ruppert <idl0r <AT> gentoo.org>
---
man/runscript.8 | 3 +++
src/rc/runscript.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/man/runscript.8 b/man/runscript.8
index 6ad6031..dbc0b7d 100644
--- a/man/runscript.8
+++ b/man/runscript.8
@@ -32,6 +32,7 @@
.Op Fl D , -nodeps
.Op Fl d , -debug
.Op Fl s , -ifstarted
+.Op Fl S , -ifstopped
.Op Fl Z , -dry-run
.Op Ar command ...
.Sh DESCRIPTION
@@ -76,6 +77,8 @@ Set xtrace on in the shell to assist in debugging.
Ignore all dependency information the service supplies.
.It Fl s , -ifstarted
Only run the command if the service has been started.
+.It Fl S , -ifstopped
+Only run the command if the service has been stopped.
.It Fl q , -quiet
Turns off all informational output the service generates.
Output from any non OpenRC commands is not affected.
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 2f66971..8e0ced9 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;
next reply other threads:[~2012-01-15 1:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-15 1:11 Christian Ruppert [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-05-15 22:11 [gentoo-commits] proj/openrc:master commit in: man/, src/rc/ William Hubbs
2018-05-15 0:11 William Hubbs
2017-05-22 17:54 William Hubbs
2017-05-22 17:54 William Hubbs
2017-04-12 22:57 William Hubbs
2016-01-28 19:08 William Hubbs
2014-01-18 7:56 William Hubbs
2013-05-02 18:58 William Hubbs
2013-04-28 18:04 William Hubbs
2012-01-26 20:51 William Hubbs
2012-01-10 3:22 Robin H. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30a56cdb4680f90e6c371c75c27c6ecec2d7aeec.idl0r@gentoo \
--to=idl0r@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox