[gentoo-commits] proj/openrc:master commit in: /, man/, sh/, src/rc/

2018-06-15 Thread William Hubbs
commit: e6d01471fe2a8eb8a15bb906d7c91c11805d1bef
Author: William Hubbs  gmail  com>
AuthorDate: Fri Jun 15 17:23:50 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jun 15 17:23:50 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e6d01471

start-stop-daemon: add ability to log stdout or stderr to processes

 NEWS.md|  9 +
 man/openrc-run.8   | 17 
 man/start-stop-daemon.8| 27 +-
 sh/start-stop-daemon.sh|  2 ++
 src/rc/Makefile|  2 +-
 src/rc/start-stop-daemon.c | 48 ++
 6 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 328247da..13c62d6e 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,15 @@ OpenRC NEWS
 This file will contain a list of notable changes for each release. Note
 the information in this file is in reverse order.
 
+## OpenRC 0.37
+
+start-stop-daemon now supports logging stdout and stderr of daemons to
+processes instead of files. These processes are defined by the
+output_logger and error_logger variables in standard service scripts, or
+by the  -3/--output-logger or -4/--error-logger switches if you use
+start-stop-daemon directly. For more information on this, see the
+start-stop-daemon man page.
+
 ## OpenRC 0.36
 
 In this release, the modules-load service has been combined into the

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index f0750406..03f8b680 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -173,6 +173,23 @@ variable is set.
 The same thing as
 .Pa output_log
 but for the standard error output.
+.It Ar output_logger
+This is a process which will be used to log the standard output from the
+service.  If you are starting this service with
+.Xr start-stop-daemon 8 ,
+,  you must set
+.Pa command_background
+to true. Keep in mind that this command must be executable as a shell
+command inside the chroot if the
+.Pa chroot
+variable is set. Keep in mind also that this command works by accepting
+the stdout of the service on stdin.
+An example of a command that can be run this way is logger if you want
+your service output to go to syslog.
+.It Ar error_logger
+The same thing as
+.Pa output_logger
+but for the standard error output.
 .It Ar directory
 .Xr start-stop-daemon 8
 and

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index 706a12ed..ecadb958 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -131,9 +131,34 @@ Modifies the scheduling priority of the daemon.
 .It Fl 1 , -stdout Ar logfile
 Redirect the standard output of the process to logfile when started with
 .Fl background .
-Must be an absolute pathname, but relative to the path optionally given with
+The logfile Must be an absolute pathname, but relative to the path
+optionally given with
 .Fl r , -chroot .
 The logfile can also be a named pipe.
+.It Fl 2 , -stderr Ar logfile
+Redirect the standard error of the process to logfile when started with
+.Fl background .
+The logfile must be an absolute pathname, but relative to the path
+optionally given with
+.Fl r , -chroot .
+The logfile can also be a named pipe.
+.It Fl 3 , -stdout-logger Ar cmd
+Run cmd as a child process redirecting the standard output to the
+standard input of cmd when started with
+.Fl background .
+Cmd must be an absolute pathname, but relative to the path optionally given 
with
+.Fl r , -chroot .
+This process must be prepared to accept input on stdin and be able to
+log it or send it to another location.
+.It Fl 4 , -stderr-logger Ar cmd
+Run cmd as a child process and 
+Redirect the standard error of the process to the standard input of cmd
+when started with
+.Fl background .
+Cmd must be an absolute pathname, but relative to the path optionally given 
with
+.Fl r , -chroot .
+This process must be prepared to accept input on stdin and be able to
+log it or send it to another location.
 .It Fl w , -wait Ar milliseconds
 Wait
 .Ar milliseconds

diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 35c642c0..69666ff7 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -47,6 +47,8 @@ ssd_start()
${directory:+--chdir} $directory \
${output_log+--stdout} $output_log \
${error_log+--stderr} $error_log \
+   ${output_logger+--stdout-logger} \"$output_logger\" \
+   ${error_logger+--stderr-logger} \"$error_logger\" \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \

diff --git a/src/rc/Makefile b/src/rc/Makefile
index 4b0983b5..b09c5058 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -158,7 +158,7 @@ rc-service: rc-service.o _usage.o rc-misc.o
 rc-update: rc-update.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ 
${LDADD}
 
-st

[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2018-05-15 Thread William Hubbs
commit: 4d47ce440c3e8f193cff82a77e6691ee6e7fac33
Author: William Hubbs  gmail  com>
AuthorDate: Tue May 15 21:59:21 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue May 15 21:59:21 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4d47ce44

rc-service: add -d/--debug and -D/--nodeps options

 man/rc-service.8| 14 ++
 src/rc/rc-service.c | 12 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/man/rc-service.8 b/man/rc-service.8
index a0202a8e..3613f8b8 100644
--- a/man/rc-service.8
+++ b/man/rc-service.8
@@ -20,6 +20,14 @@
 .Ar service cmd
 .Op Ar ...
 .Nm
+.Fl d , -debug
+.Ar service cmd
+.Op Ar ...
+.Nm
+.Fl D , -nodeps
+.Ar service cmd
+.Op Ar ...
+.Nm
 .Op Fl i , -ifexists
 .Ar service cmd
 .Op Ar ...
@@ -72,6 +80,12 @@ otherwise -1.
 .Fl r , -resolve
 does the same and also prints the full path of the service to stdout.
 .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
 prints out the commands it would execute rather than executing them.
 .Sh SEE ALSO

diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 77f0336b..ea69dab5 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -29,8 +29,10 @@
 
 const char *applet = 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[] = {
+   { "debug", 0, NULL, 'd' },
+   { "nodeps", 0, NULL, 'D' },
{ "exists",   1, NULL, 'e' },
{ "ifcrashed", 0, NULL, 'c' },
{ "ifexists", 0, NULL, 'i' },
@@ -42,6 +44,8 @@ const struct option longopts[] = {
longopts_COMMON
 };
 const char * const longopts_help[] = {
+   "set xtrace when running the command",
+   "ignore dependencies",
"tests if the service exists or not",
"if the service is crashed 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)
{
switch (opt) {
+   case 'd':
+   setenv("RC_DEBUG", "yes", 1);
+   break;
+   case 'D':
+   setenv("RC_NODEPS", "yes", 1);
+   break;
case 'e':
service = rc_service_resolve(optarg);
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;



[gentoo-commits] proj/openrc:master commit in: man/

2018-05-15 Thread William Hubbs
commit: 56870d0db18209396f8276bdc05d413fe4dd7a88
Author: William Hubbs  gmail  com>
AuthorDate: Tue May 15 22:09:56 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue May 15 22:09:56 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=56870d0d

Man: rc-service man page cleanups

 man/rc-service.8 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/man/rc-service.8 b/man/rc-service.8
index 3613f8b8..2834f361 100644
--- a/man/rc-service.8
+++ b/man/rc-service.8
@@ -44,7 +44,8 @@
 .Ar service
 .Nm
 .Fl Z , -dry-run
-.Ar service
+.Ar service cmd
+.Op Ar ...
 .Nm
 .Fl l , -list
 .Nm
@@ -87,7 +88,7 @@ sets -x when running the service script(s).
 ignores dependencies when running the service.
 .Pp
 .Fl Z , -dry-run
-prints out the commands it would execute rather than executing them.
+displays commands rather than executing them.
 .Sh SEE ALSO
 .Xr openrc 8 ,
 .Xr stdout 3



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2018-05-14 Thread William Hubbs
commit: a7f475ca04856ef8232364c5b0c3191566b0696c
Author: William Hubbs  gmail  com>
AuthorDate: Tue May 15 00:00:04 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue May 15 00:00:04 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a7f475ca

rc-service: add a --dry-run option

This is for #225.

 man/rc-service.8| 6 ++
 src/rc/rc-service.c | 7 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/man/rc-service.8 b/man/rc-service.8
index 8f075de4..a0202a8e 100644
--- a/man/rc-service.8
+++ b/man/rc-service.8
@@ -35,6 +35,9 @@
 .Fl e , -exists
 .Ar service
 .Nm
+.Fl Z , -dry-run
+.Ar service
+.Nm
 .Fl l , -list
 .Nm
 .Fl r , -resolve
@@ -68,6 +71,9 @@ return 0 if it can find
 otherwise -1.
 .Fl r , -resolve
 does the same and also prints the full path of the service to stdout.
+.Pp
+.Fl Z , -dry-run
+prints out the commands it would execute rather than executing them.
 .Sh SEE ALSO
 .Xr openrc 8 ,
 .Xr stdout 3

diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 8e7b00dc..77f0336b 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -29,7 +29,7 @@
 
 const char *applet = NULL;
 const char *extraopts = NULL;
-const char *getoptstring = "ce:ilr:IN" getoptstring_COMMON;
+const char *getoptstring = "ce:ilr:INZ" getoptstring_COMMON;
 const struct option longopts[] = {
{ "exists",   1, NULL, 'e' },
{ "ifcrashed", 0, NULL, 'c' },
@@ -38,6 +38,7 @@ const struct option longopts[] = {
{ "ifnotstarted", 0, NULL, 'N' },
{ "list", 0, NULL, 'l' },
{ "resolve",  1, NULL, 'r' },
+   { "dry-run", 0, NULL, 'Z' },
longopts_COMMON
 };
 const char * const longopts_help[] = {
@@ -48,6 +49,7 @@ const char * const longopts_help[] = {
"if the service is not started then run the command",
"list all available services",
"resolve the service name to an init script",
+   "dry run (show what would happen)",
longopts_help_COMMON
 };
 const char *usagestring = ""   
\
@@ -112,6 +114,9 @@ int main(int argc, char **argv)
free(service);
return EXIT_SUCCESS;
/* NOTREACHED */
+   case 'Z':
+   setenv("IN_DRYRUN", "yes", 1);
+   break;
 
case_RC_COMMON_GETOPT
}



[gentoo-commits] proj/openrc:master commit in: man/

2018-05-07 Thread William Hubbs
commit: 49a90f27a848ba02a363fc0c844d6284728bdd73
Author: William Hubbs  gmail  com>
AuthorDate: Tue Apr 24 15:40:57 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Apr 24 15:40:57 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=49a90f27

typo fix

 man/openrc-run.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 426afdcc..f9109ef3 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -594,7 +594,7 @@ rc_net_tap1_provide="!net"
 # It's also possible to negate keywords. This is mainly useful for prefix
 # users testing OpenRC.
 rc_keyword="!-prefix"
-# This can also be used to block a script from runining in all
+# This can also be used to block a script from running in all
 # containers except one or two
 rc_keyword="!-containers !-docker"
 .Ed



[gentoo-commits] proj/openrc:master commit in: man/

2018-03-12 Thread William Hubbs
commit: fa3c60c0d8fd2267be5c1b156530b136a2503088
Author: William Hubbs  gmail  com>
AuthorDate: Mon Mar 12 23:15:06 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Mar 12 23:15:06 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fa3c60c0

man: document default retry sppecification for start-stop-daemon

 man/start-stop-daemon.8 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index 1506a1a5..706a12ed 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -151,6 +151,7 @@ These options are only used for stopping daemons:
 .It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
 The retry specification can be either a timeout in seconds or multiple
 signal/timeout pairs (like SIGTERM/5).
+If this option is not given, the default is SIGTERM/5.
 .El
 .Sh ENVIRONMENT
 .Va SSD_IONICELEVEL



[gentoo-commits] proj/openrc:master commit in: man/

2018-03-12 Thread William Hubbs
commit: 122768d339175c925a1a228792f4725b7c802f46
Author: William Hubbs  gmail  com>
AuthorDate: Mon Mar 12 23:22:05 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Mar 12 23:22:40 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=122768d3

man: document default retry specification for supervise-daemon

 man/supervise-daemon.8 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/man/supervise-daemon.8 b/man/supervise-daemon.8
index 0d34a249..af06ee31 100644
--- a/man/supervise-daemon.8
+++ b/man/supervise-daemon.8
@@ -120,6 +120,7 @@ description of --respawn-max for more information.
 .It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
 The retry specification can be either a timeout in seconds or multiple
 signal/timeout pairs (like SIGTERM/5).
+If this option is not given, the default is SIGTERM/5.
 .It Fl r , -chroot Ar path
 chroot to this directory before starting the daemon. All other paths, such
 as the path to the daemon, chdir and pidfile, should be relative to the chroot.



[gentoo-commits] proj/openrc:master commit in: man/

2018-02-10 Thread William Hubbs
commit: 4c517bdb2b69eac36f004ae41bb9cbb212fe0a51
Author: Michael Orlitzky  orlitzky  com>
AuthorDate: Thu Jan 25 16:27:16 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Feb  6 19:52:36 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4c517bdb

man/openrc-run.8: add missing "Xo" tags for fstabinfo and mountinfo.

The BUILTINS are all surrounded by Xo...Xc tags, but the opening "Xo"
was missing from the two commands fstabinfo and mountinfo. This commit
adds them, and thereby fixes the spacing when viewed by man.

This is for #204.

 man/openrc-run.8 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 5f9c86dd..9078ff95 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -470,6 +470,7 @@ Also, the -d, -f or -p options should not be specified 
along with this option.
 .Pp
 The -q option suppresses all informational output. If it is specified
 twice, all error messages are suppressed as well.
+.It Xo
 .Ic fstabinfo
 .Op Fl M , -mount
 .Op Fl R , -remount
@@ -486,6 +487,7 @@ remounted.
 .Pp
 The -q option suppresses all informational output. If it is specified
 twice, all error messages are suppressed as well.
+.It Xo
 .Ic mountinfo
 .Op Fl f, -fstype-regex Ar regex
 .Op Fl F, -skip-fstype-regex Ar regex



[gentoo-commits] proj/openrc:master commit in: man/

2018-02-10 Thread William Hubbs
commit: c1ffe4d9f2e10b6853464cc298d1922c81ae92f4
Author: Michael Orlitzky  orlitzky  com>
AuthorDate: Thu Jan 25 16:28:39 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Feb  6 19:53:11 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c1ffe4d9

man/openrc-run.8: fix mountinfo args.

The "Ar" tag for the mountinfo command contained a typo (leading
space) that resulted in the tag being output verbatim; that is,

  mountinfo ... .Ar mount1 mount2

rather than e.g.

  mountinfo ...  

This commit deletes the leading space to fix the output.

This fixes #204.

 man/openrc-run.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 9078ff95..426afdcc 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -502,7 +502,7 @@ twice, all error messages are suppressed as well.
 .Op Fl i, -options
 .Op Fl s, -fstype
 .Op Fl t, -node
-  .Ar mount1 mount2 ...
+.Ar mount1 mount2 ...
 .Xc
 The f, F, n, N, o, O, p, P, e and E options specify what you want to
 search for or skip in the mounted file systems. The i, s and t options



[gentoo-commits] proj/openrc:master commit in: man/

2017-11-30 Thread William Hubbs
commit: 0feadd2922484ec181c2ab86a5f7f8d6d37c5c77
Author: William Hubbs  gmail  com>
AuthorDate: Thu Nov 30 22:00:42 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Nov 30 22:00:42 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0feadd29

man/openrc-run.8: update documentation for command_user

 man/openrc-run.8 | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3325139f..5f9c86dd 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -8,7 +8,7 @@
 .\" This file may not be copied, modified, propagated, or distributed
 .\"except according to the terms contained in the LICENSE file.
 .\"
-.Dd December 31, 2011
+.Dd November 30, 2017
 .Dt openrc-run 8 SMM
 .Os OpenRC
 .Sh NAME
@@ -152,11 +152,11 @@ Set this to "true", "yes" or "1" (case-insensitive) if 
you want
 to display a progress meter when waiting for a daemon to stop.
 .It Ar command_user
 If the daemon does not support changing to a different user id, you can
-use this to change the user id before
+use this to change the user id, and optionally group id,  before
 .Xr start-stop-daemon 8
 or
 .Xr supervise-daemon 8
-launches the daemon
+launches the daemon.
 .It Ar output_log
 This is the path to a file or named pipe where the standard output from
 the service will be redirected. If you are starting this service with
@@ -731,6 +731,8 @@ Users are encouraged to use the is_newer_than function 
which returns correctly.
 .Xr rc_plugin_hook 3 ,
 .Xr sh 1p ,
 .Xr start-stop-daemon 8 ,
+.Xr supervise-daemon 8 ,
 .Xr uname 1
 .Sh AUTHORS
 .An Roy Marples 
+.An William Hubbs 



[gentoo-commits] proj/openrc:master commit in: man/

2017-11-29 Thread William Hubbs
commit: f0129307759f1a5eb34b72589e8d48790c92b2db
Author: Julien Reichardt  jrei  ch>
AuthorDate: Wed Nov 29 21:01:32 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Nov 29 21:06:06 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=f0129307

man/openrc-run.8: remove white space

This is for #184.

 man/openrc-run.8 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index e1db58bd..3325139f 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -142,12 +142,12 @@ List of arguments to pass to the daemon when starting via
 .Nm supervise-daemon .
 to force the daemon to stay in the foreground
 .It Ar command_background
-Set this to "true", "yes" or "1" (case-insensitive) if you want 
+Set this to "true", "yes" or "1" (case-insensitive) if you want
 .Xr start-stop-daemon 8
 to force the daemon into the background. This forces the
 "--make-pidfile" and "--pidfile" options, so the pidfile variable must be set.
 .It Ar command_progress
-Set this to "true", "yes" or "1" (case-insensitive) if you want 
+Set this to "true", "yes" or "1" (case-insensitive) if you want
 .Xr start-stop-daemon 8
 to display a progress meter when waiting for a daemon to stop.
 .It Ar command_user



[gentoo-commits] proj/openrc:master commit in: man/

2017-10-12 Thread William Hubbs
commit: 2b6eeea01d1c64d58929788f4bfa0758393885bf
Author: William Hubbs  gmail  com>
AuthorDate: Thu Oct 12 23:47:36 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Oct 12 23:47:36 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=2b6eeea0

man: remove service(8) man page

 man/Makefile  | 2 +-
 man/service.8 | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/man/Makefile b/man/Makefile
index a72b7e72..006c8d16 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -6,7 +6,7 @@ MAN3=   einfo.3 \
rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
rc_runlevel.3 rc_service.3 rc_stringlist.3
 MAN8=  rc-service.8 rc-status.8 rc-update.8 openrc.8 openrc-run.8 \
-   service.8 start-stop-daemon.8 supervise-daemon.8
+   start-stop-daemon.8 supervise-daemon.8
 
 ifeq (${OS},Linux)
 MAN8 += rc-sstat.8 openrc-init.8 openrc-shutdown.8

diff --git a/man/service.8 b/man/service.8
deleted file mode 100644
index cd9dfa88..
--- a/man/service.8
+++ /dev/null
@@ -1 +0,0 @@
-.so rc-service.8



[gentoo-commits] proj/openrc:master commit in: man/

2017-09-22 Thread William Hubbs
commit: c46adf14343df3a74aef7e4ae5be175ae5fa7a01
Author: William Hubbs  gmail  com>
AuthorDate: Fri Sep 22 21:20:41 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Sep 22 21:24:20 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c46adf14

man/openrc-run.8: Clarify the explanation of the need dependency

 man/openrc-run.8 | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 2e3ec728..471f63e5 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -217,8 +217,10 @@ that dependency type to the function, or prefix the names 
with ! to
 remove them from the dependencies.
 .Bl -tag -width "RC_DEFAULTLEVEL"
 .It Ic need
-The service will refuse to start until needed services have started and it
-will refuse to stop until any services that need it have stopped.
+The service will attempt to start any services it needs regardless of
+whether they have been added to the runlevel. It will refuse to start
+until all services it needs have started, and it will refuse to stop until all
+services that need it have stopped.
 .It Ic use
 The service will attempt to start any services it uses that have been added
 to the runlevel.



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/, sh/

2017-09-06 Thread William Hubbs
commit: 17b5cc78d35dc5fe4904e5951715c3e0d07d6343
Author: William Hubbs  gmail  com>
AuthorDate: Wed Sep  6 18:22:30 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Sep  6 22:22:21 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=17b5cc78

add retry option to supervise-daemon

The --retry option for supervise-daemon defines how the supervisor will
attempt to stop the child process it is monitoring. It is defined when
the supervisor is started since stopping the supervisor just sends a
signal to the active supervisor.

This fixes #160.

 man/supervise-daemon.8|  5 +
 sh/supervise-daemon.sh|  1 +
 src/rc/Makefile   |  2 +-
 src/rc/supervise-daemon.c | 26 +++---
 4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/man/supervise-daemon.8 b/man/supervise-daemon.8
index 34a4e936..0d34a249 100644
--- a/man/supervise-daemon.8
+++ b/man/supervise-daemon.8
@@ -36,6 +36,8 @@
 .Ar pidfile
 .Fl P , -respawn-period
 .Ar seconds
+.Fl R , -retry
+.Ar arg
 .Fl r , -chroot
 .Ar chrootpath
 .Fl u , -user
@@ -115,6 +117,9 @@ Modifies the scheduling priority of the daemon.
 .It Fl P , -respawn-period Ar seconds
 Sets the length of a respawn period. The default is 10 seconds. See the
 description of --respawn-max for more information.
+.It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
+The retry specification can be either a timeout in seconds or multiple
+signal/timeout pairs (like SIGTERM/5).
 .It Fl r , -chroot Ar path
 chroot to this directory before starting the daemon. All other paths, such
 as the path to the daemon, chdir and pidfile, should be relative to the chroot.

diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 8add2147..1c1b840d 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -23,6 +23,7 @@ supervise_start()
# command_args="this \"is a\" test"
# to work properly.
eval supervise-daemon --start \
+   ${retry:+--retry} $retry \
${chroot:+--chroot} $chroot \
${pidfile:+--pidfile} $pidfile \
${respawn_delay:+--respawn-delay} $respawn_delay \

diff --git a/src/rc/Makefile b/src/rc/Makefile
index e6c9f4a2..a2c7c306 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -159,7 +159,7 @@ rc-update: rc-update.o _usage.o rc-misc.o
 start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-schedules.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ 
${LDADD}
 
-supervise-daemon: supervise-daemon.o _usage.o rc-misc.o
+supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-schedules.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ 
${LDADD}
 
 service_get_value service_set_value get_options save_options: do_value.o 
rc-misc.o

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index c59fb099..3923dab5 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -61,12 +61,13 @@ static struct pam_conv conv = { NULL, NULL};
 #include "queue.h"
 #include "rc.h"
 #include "rc-misc.h"
+#include "rc-schedules.h"
 #include "_usage.h"
 #include "helpers.h"
 
 const char *applet = NULL;
 const char *extraopts = NULL;
-const char *getoptstring = "D:d:e:g:I:Kk:m:N:p:r:Su:1:2:" \
+const char *getoptstring = "D:d:e:g:I:Kk:m:N:p:R:r:Su:1:2:" \
getoptstring_COMMON;
 const struct option longopts[] = {
{ "respawn-delay",1, NULL, 'D'},
@@ -80,6 +81,7 @@ const struct option longopts[] = {
{ "nicelevel",1, NULL, 'N'},
{ "pidfile",  1, NULL, 'p'},
{ "respawn-period",1, NULL, 'P'},
+   { "retry",   1, NULL, 'R'},
{ "chroot",   1, NULL, 'r'},
{ "start",0, NULL, 'S'},
{ "user", 1, NULL, 'u'},
@@ -99,6 +101,7 @@ const char * const longopts_help[] = {
"Set a nicelevel when starting",
"Match pid found in this file",
"Set respawn time period",
+   "Retry schedule to use when stopping",
"Chroot to this directory",
"Start daemon",
"Change the process user",
@@ -410,6 +413,9 @@ int main(int argc, char **argv)
bool stop = false;
char *exec = NULL;
char *pidfile = NULL;
+   char *retry = NULL;
+   int nkilled;
+   int sig = SIGTERM;
char *home = NULL;
int tid = 0;
pid_t child_pid, pid;
@@ -534,6 +540,9 @@ int main(int argc, char **argv)
pidfile = optarg;
break;
 
+   case 'R':  /* --retry |timeout */
+   retry = optarg;
+   break;
case 'r':  /* --chroot /new/root */
ch_root = optarg;
break;
@@ -605,6 +614,10 @@ int main(int argc, char **argv)
"than %d to avoid infinite respawning", applet, 

[gentoo-commits] proj/openrc:master commit in: man/

2017-07-26 Thread William Hubbs
commit: c2d256bafb9d1dfafbfd0846c035c5d26f7449c8
Author: William Hubbs  gmail  com>
AuthorDate: Wed Jul 26 16:29:10 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Jul 26 16:31:34 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c2d256ba

man/openrc-run.8: document fstabinfo and mountinfo

X-Gentoo-Bug: 592374
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592374

 man/openrc-run.8 | 36 
 1 file changed, 36 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3fb5a5b3..2e3ec728 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -445,6 +445,42 @@ Also, the -d, -f or -p options should not be specified 
along with this option.
 .Pp
 The -q option suppresses all informational output. If it is specified
 twice, all error messages are suppressed as well.
+.Ic fstabinfo
+.Op Fl M , -mount
+.Op Fl R , -remount
+.Op Fl b , -blockdevice
+.Op Fl m , -mountargs
+.Op Fl o , -options
+.Op Fl p , -passno Ar passno
+.Op Fl t , -type Ar fstype
+.Ar path
+.Xc
+If -b, -m, -o, -p or -t is specified,the appropriate information is
+extracted from fstab. If -M or -R are given, file systems are mounted or
+remounted.
+.Pp
+The -q option suppresses all informational output. If it is specified
+twice, all error messages are suppressed as well.
+.Ic mountinfo
+.Op Fl f, -fstype-regex Ar regex
+.Op Fl F, -skip-fstype-regex Ar regex
+.Op Fl n, -node-regex Ar regex
+.Op Fl N, -skip-node-regex Ar regex
+.Op Fl o, -options-regex Ar regex
+.Op Fl O, -skip-options-regex Ar regex
+.Op Fl p, -point-regex Ar regex
+.Op Fl P, -skip-point-regex Ar regex
+.Op Fl e, -netdev
+.Op Fl E, -nonetdev
+.Op Fl i, -options
+.Op Fl s, -fstype
+.Op Fl t, -node
+  .Ar mount1 mount2 ...
+.Xc
+The f, F, n, N, o, O, p, P, e and E options specify what you want to
+search for or skip in the mounted file systems. The i, s and t options
+specify what you want to display. If no mount points are given, all
+mount points will be considered.
 .It Ic yesno Ar value
 If
 .Ar value



[gentoo-commits] proj/openrc:master commit in: man/

2017-07-25 Thread William Hubbs
commit: f48d9c33a5c708c871d6657a39485d1c0c735548
Author: William Hubbs  gmail  com>
AuthorDate: Tue Jul 25 18:54:12 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jul 25 18:54:12 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=f48d9c33

man/openrc-run.8: document _pre and _post functions

Fixes https://github.com/openrc/openrc/issues/155.

 man/openrc-run.8 | 12 
 1 file changed, 12 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 278aa0e1..3fb5a5b3 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -284,6 +284,18 @@ system.
 To see how to influence dependencies in configuration files, see the
 .Sx FILES
 section below.
+.Sh _pre AND _post FUNCTIONS
+Any command defined in extra_commands, extra_started_commands or
+extra_stopped_commands can have _pre and _post functions in the service
+script. If the command function is called foo, the_pre and _post
+functions for it should be called foo_pre and foo_post.
+.Pp
+These functions should be used to perform preparation before the
+command is run and cleanup after the command completes. In order for
+.Nm
+to record the command as being run successfully, the _pre
+function, command function itself and the _post function should all exit
+with a zero return code.
 .Sh BUILTINS
 .Nm
 defines some builtin functions that you can use inside your service scripts:



[gentoo-commits] proj/openrc:master commit in: man/

2017-07-08 Thread William Hubbs
commit: 12f75e4167f84a9a85f69924ebdb28ad36c085cb
Author: Adam Borowski  angband  pl>
AuthorDate: Fri Jul  7 00:11:00 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jul  7 22:14:31 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=12f75e41

man: fix an unclosed .Bl/.El warning

This fixes #151.

 man/supervise-daemon.8 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/man/supervise-daemon.8 b/man/supervise-daemon.8
index 19aa5d44..34a4e936 100644
--- a/man/supervise-daemon.8
+++ b/man/supervise-daemon.8
@@ -130,6 +130,7 @@ The same thing as
 .Fl 1 , -stdout
 but with the standard error output.
 .El
+.El
 .Sh ENVIRONMENT
 .Va SSD_NICELEVEL
 can also set the scheduling priority of the daemon, but the command line



[gentoo-commits] proj/openrc:master commit in: man/

2017-07-08 Thread William Hubbs
commit: 260368e0103e95625c29760f2c2ec89143e5a233
Author: Adam Borowski  angband  pl>
AuthorDate: Fri Jul  7 00:06:34 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jul  7 22:13:40 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=260368e0

man: fix missing .Pp warnings

This fixes #151.

 man/openrc-run.8 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index f627004d..278aa0e1 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -412,25 +412,25 @@ If -d, -f or -p is specified, checkpath checks to see if 
the path
 exists, is the right type and has the correct owner and access modes. If
 any of these tests fail, the path is created and set up as specified. If
 more than one of -d, -f or -p are specified, the last one will be used.
-
+.Pp
 The argument to -m is a three or four digit octal number. If this option
 is not provided, the value defaults to 0644 for files and 0775 for
 directories.
-
+.Pp
 The argument to -o is a representation of the user and/or group which
 should own the path. The user and group can be represented numerically
 or with names, and are separated by a colon.
-
+.Pp
 The truncate options (-D and -F) cause the directory or file to be
 cleared of all contents.
-
+.Pp
 If -W is specified, checkpath checks to see if the first path given on
 the command line is writable.  This is different from how the test
 command in the shell works, because it also checks to make sure the file
 system is not read only.
-
+.Pp
 Also, the -d, -f or -p options should not be specified along with this option.
-
+.Pp
 The -q option suppresses all informational output. If it is specified
 twice, all error messages are suppressed as well.
 .It Ic yesno Ar value



[gentoo-commits] proj/openrc:master commit in: man/

2017-06-07 Thread William Hubbs
commit: caacedc0a82285fb2d25c6d3473f154044c7ad66
Author: William Hubbs  gmail  com>
AuthorDate: Wed Jun  7 16:28:01 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Jun  7 16:28:01 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=caacedc0

man: update openrc-shutdown man page

Add the new wtmp options and fix some cross references.

 man/openrc-shutdown.8 | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8
index 5d81c4af..5db21334 100644
--- a/man/openrc-shutdown.8
+++ b/man/openrc-shutdown.8
@@ -16,25 +16,33 @@
 .Nd bring the system down
 .Sh SYNOPSIS
 .Nm
+.Op Fl d , -no-write
+.Op Fl D , -dry-run
 .Op Fl H , -halt
 .Op Fl k , -kexec
 .Op Fl p , -poweroff
 .Op Fl R , -reexec
 .Op Fl r , -reboot
+.Op Fl s , -single
+.Op Fl w , -write-only
 .Sh DESCRIPTION
 .Nm
-is the utility that communicates with openrc-init(8) to bring down the
-system or instruct openrc-init to re-execute itself. It supports the
-following options:
+is the utility that communicates with
+.Xr openrc-init 8
+to bring down the system or instruct openrc-init to re-execute itself.
+It supports the following options:
 .Bl -tag -width "poweroff"
-.It Fl d , -dry-run
+.It Fl d , -no-write
+Do not write the wtmp boot record.
+.It Fl D , -dry-run
 Print the action that would be taken without executing it. This is to
 allow testing.
 .It Fl H , -halt
 Stop all services, kill all remaining processes and halt the system.
 .It Fl k , -kexec
 Stop all services, kill all processes and boot directly into a new
-kernel loaded via kexec(8).
+kernel loaded via
+.Xr kexec 8 .
 .It Fl p , -poweroff
 Stop all services, kill all processes and power off the system.
 .It Fl R , -reexec
@@ -42,10 +50,11 @@ instruct openrc-init to re-exec itself. This should be used 
after an
 upgrade of OpenRC if you are using openrc-init as your init process.
 .It Fl r , -reboot
 Stop all services, kill all processes and reboot the system.
+.It Fl s , -single
+Stop all services, kill all processes and move to single user mode.
+.It Fl w , -write-only
+Stop all services, kill all processes and move to single user mode.
 .El
-.Pp
-If none of these options are given, the default is to move the system
-into single user mode.
 .Sh SEE ALSO
 .Xr openrc-init 8 ,
 .Xr kexec 8 ,



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2017-05-22 Thread William Hubbs
commit: 0cfd0dd9ef580ed9dc563ccc164d70efe8f299db
Author: William Hubbs  gmail  com>
AuthorDate: Mon May 22 17:15:15 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon May 22 17:15:15 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0cfd0dd9

openrc-shutdown: move to single user mode by default

To be more compatible with sysvinit, move to single user mode if no
options are specified on the command line.

 man/openrc-shutdown.8| 5 -
 src/rc/openrc-shutdown.c | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8
index eae16ae8..d0e95e24 100644
--- a/man/openrc-shutdown.8
+++ b/man/openrc-shutdown.8
@@ -8,7 +8,7 @@
 .\" This file may not be copied, modified, propagated, or distributed
 .\"except according to the terms contained in the LICENSE file.
 .\"
-.Dd April 6, 2017
+.Dd May 22, 2017
 .Dt openrc-shutdown 8 SMM
 .Os OpenRC
 .Sh NAME
@@ -40,6 +40,9 @@ upgrade of OpenRC if you are using openrc-init as your init 
process.
 .It Fl r , -reboot
 Stop all services, kill all processes and reboot the system.
 .El
+.Pp
+If none of these options are given, the default is to move the system
+into single user mode.
 .Sh SEE ALSO
 .Xr openrc-init 8 ,
 .Xr kexec 8 ,

diff --git a/src/rc/openrc-shutdown.c b/src/rc/openrc-shutdown.c
index 8905d354..0ed77445 100644
--- a/src/rc/openrc-shutdown.c
+++ b/src/rc/openrc-shutdown.c
@@ -114,7 +114,7 @@ if (geteuid() != 0)
case_RC_COMMON_GETOPT
}
}
-   if (cmd_count != 1) {
+   if (cmd_count > 1) {
eerror("%s: %s\n", applet, exclusive);
usage(EXIT_FAILURE);
}
@@ -128,5 +128,7 @@ if (geteuid() != 0)
send_cmd("reboot");
else if (do_reexec)
send_cmd("reexec");
+   else
+   send_cmd("single");
return 0;
 }



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2017-05-22 Thread William Hubbs
commit: 1ece16bfcd0ab71d2f9fe17a75ee6184e0fa4828
Author: William Hubbs  gmail  com>
AuthorDate: Mon May 22 17:42:37 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon May 22 17:42:37 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1ece16bf

openrc-shutdown: add dry-run option

 man/openrc-shutdown.8|  3 +++
 src/rc/openrc-shutdown.c | 31 ---
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8
index d0e95e24..5d81c4af 100644
--- a/man/openrc-shutdown.8
+++ b/man/openrc-shutdown.8
@@ -27,6 +27,9 @@ is the utility that communicates with openrc-init(8) to bring 
down the
 system or instruct openrc-init to re-execute itself. It supports the
 following options:
 .Bl -tag -width "poweroff"
+.It Fl d , -dry-run
+Print the action that would be taken without executing it. This is to
+allow testing.
 .It Fl H , -halt
 Stop all services, kill all remaining processes and halt the system.
 .It Fl k , -kexec

diff --git a/src/rc/openrc-shutdown.c b/src/rc/openrc-shutdown.c
index 0ed77445..ecb251a8 100644
--- a/src/rc/openrc-shutdown.c
+++ b/src/rc/openrc-shutdown.c
@@ -35,8 +35,9 @@
 
 const char *applet = NULL;
 const char *extraopts = NULL;
-const char *getoptstring = "HkpRr" getoptstring_COMMON;
+const char *getoptstring = "dHkpRr" getoptstring_COMMON;
 const struct option longopts[] = {
+   { "dry-run",no_argument, NULL, 'd'},
{ "halt",no_argument, NULL, 'H'},
{ "kexec",no_argument, NULL, 'k'},
{ "poweroff",no_argument, NULL, 'p'},
@@ -45,6 +46,7 @@ const struct option longopts[] = {
longopts_COMMON
 };
 const char * const longopts_help[] = {
+   "print actions instead of executing them",
"halt the system",
"reboot the system using kexec",
"power off the system",
@@ -56,13 +58,16 @@ const char *usagestring = NULL;
 const char *exclusive = "Select one of "
 "--halt, --kexec, --poweroff, --reexec or --reboot";
 
-static void send_cmd(const char *cmd)
+static void send_cmd(const char *cmd, bool dryrun)
 {
FILE *fifo;
size_t ignored;
 
+   if (dryrun) {
+   einfo("Would send %s to init", cmd);
+   return;
+   }
fifo = fopen(RC_INIT_FIFO, "w");
-
if (!fifo) {
perror("fopen");
return;
@@ -78,6 +83,7 @@ int main(int argc, char **argv)
 {
int opt;
int cmd_count = 0;
+   bool do_dryrun = false;
bool do_halt = false;
bool do_kexec = false;
bool do_poweroff = false;
@@ -85,12 +91,13 @@ int main(int argc, char **argv)
bool do_reexec = false;
 
applet = basename_c(argv[0]);
-if (geteuid() != 0)
-   eerrorx("%s: you must be root\n", applet);
while ((opt = getopt_long(argc, argv, getoptstring,
longopts, (int *) 0)) != -1)
{
switch (opt) {
+   case 'd':
+   do_dryrun = true;
+   break;
case 'H':
do_halt = true;
cmd_count++;
@@ -114,21 +121,23 @@ if (geteuid() != 0)
case_RC_COMMON_GETOPT
}
}
+if (geteuid() != 0 && ! do_dryrun)
+   eerrorx("%s: you must be root\n", applet);
if (cmd_count > 1) {
eerror("%s: %s\n", applet, exclusive);
usage(EXIT_FAILURE);
}
if (do_halt)
-   send_cmd("halt");
+   send_cmd("halt", do_dryrun);
else if (do_kexec)
-   send_cmd("kexec");
+   send_cmd("kexec", do_dryrun);
else if (do_poweroff)
-   send_cmd("poweroff");
+   send_cmd("poweroff", do_dryrun);
else if (do_reboot)
-   send_cmd("reboot");
+   send_cmd("reboot", do_dryrun);
else if (do_reexec)
-   send_cmd("reexec");
+   send_cmd("reexec", do_dryrun);
else
-   send_cmd("single");
+   send_cmd("single", do_dryrun);
return 0;
 }



[gentoo-commits] proj/openrc:master commit in: man/

2017-05-11 Thread William Hubbs
commit: 78e0042eccaf5a5554b195ad391b3ab0b8974cf6
Author: William Hubbs  gmail  com>
AuthorDate: Fri May 12 02:53:23 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri May 12 02:55:31 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=78e0042e

man/rc-status: document changes for supervised daemons

rc-status now shows the amount of time a supervised daemon has been
active as well as the number of times it has been respawned during the
current respawn period.

 man/rc-status.8 | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/man/rc-status.8 b/man/rc-status.8
index 3b33df4a..6cf69a59 100644
--- a/man/rc-status.8
+++ b/man/rc-status.8
@@ -25,6 +25,12 @@ in different runlevels.  The default behavior is to show 
information
 about the current runlevel and any unassigned services that are not stopped,
 but any runlevel can be quickly examined.
 .Pp
+If an active service is being supervised by
+.Xr supervise-daemon 8, 
+the amount of time the daemon has been active along with the number of
+times it has been respawned in the current respawn period will be
+displayed.
+.Pp
 The options are as follows:
 .Bl -tag -width ".Fl test , test string"
 .It Fl a , -all
@@ -57,5 +63,6 @@ dependency order if the dependency tree is available.
 .Sh SEE ALSO
 .Xr openrc 8 ,
 .Xr rc-update 8
+.Xr supervise-daemon 8
 .Sh AUTHORS
 .An Roy Marples 



[gentoo-commits] proj/openrc:master commit in: man/

2017-04-14 Thread William Hubbs
commit: 5fd3747b190887d094225547f23007d25e2d9592
Author: William Hubbs  gmail  com>
AuthorDate: Fri Apr 14 16:10:56 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Apr 14 16:11:07 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5fd3747b

reword the bugs section of the openrc-init man page

 man/openrc-init.8 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/openrc-init.8 b/man/openrc-init.8
index 93068f10..8cd4d02b 100644
--- a/man/openrc-init.8
+++ b/man/openrc-init.8
@@ -37,9 +37,9 @@ doesn't manage getty's directly, so you will need to manage 
them another
 way. For example, you can use the agetty service script as described in
 agetty-guide.md in this distribution.
 .Sh BUGS
-OpenRC 0.25 contains the first release of this init process.
-I do not know of any specific issues. However, if you use it, please be
-aware that there may be bugs and report any issues you find.
+This was first released as part of OpenRC 0.25.
+I do not know of any specific issues. However, since this is the first
+release of openrc-init, please test and report any issues you find.
 .Sh SEE ALSO
 .Xr openrc-shutdown 8 ,
 .Sh AUTHORS



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2017-04-12 Thread William Hubbs
commit: 05738bfce120114037d4f02c67ec740813f94b89
Author: William Hubbs  gmail  com>
AuthorDate: Wed Apr 12 22:56:30 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Apr 12 22:56:36 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=05738bfc

init: add re-exec capability

This will allow the re-execution of the init process after upgrading
OpenRC.

 man/openrc-shutdown.8|  7 ++-
 src/rc/openrc-init.c | 22 +++---
 src/rc/openrc-shutdown.c | 14 --
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8
index 98ec64a6..eae16ae8 100644
--- a/man/openrc-shutdown.8
+++ b/man/openrc-shutdown.8
@@ -19,11 +19,13 @@
 .Op Fl H , -halt
 .Op Fl k , -kexec
 .Op Fl p , -poweroff
+.Op Fl R , -reexec
 .Op Fl r , -reboot
 .Sh DESCRIPTION
 .Nm
 is the utility that communicates with openrc-init(8) to bring down the
-system.  The following options affect how the system is brought down:
+system or instruct openrc-init to re-execute itself. It supports the
+following options:
 .Bl -tag -width "poweroff"
 .It Fl H , -halt
 Stop all services, kill all remaining processes and halt the system.
@@ -32,6 +34,9 @@ Stop all services, kill all processes and boot directly into 
a new
 kernel loaded via kexec(8).
 .It Fl p , -poweroff
 Stop all services, kill all processes and power off the system.
+.It Fl R , -reexec
+instruct openrc-init to re-exec itself. This should be used after an
+upgrade of OpenRC if you are using openrc-init as your init process.
 .It Fl r , -reboot
 Stop all services, kill all processes and reboot the system.
 .El

diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c
index fb3347a4..61052806 100644
--- a/src/rc/openrc-init.c
+++ b/src/rc/openrc-init.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,6 +80,12 @@ static void init(const char *default_runlevel)
waitpid(pid, NULL, 0);
 }
 
+static void handle_reexec(char *my_name)
+{
+   execl(my_name, my_name, "reexec", NULL);
+   return;
+}
+
 static void handle_shutdown(const char *runlevel, int cmd)
 {
pid_t pid;
@@ -123,10 +130,11 @@ static void signal_handler(int sig)
 
 int main(int argc, char **argv)
 {
-   char *default_runlevel = NULL;
+   char *default_runlevel;
char buf[2048];
int count;
FILE *fifo;
+   bool reexec = false;
struct sigaction sa;
 
if (getpid() != 1)
@@ -134,16 +142,22 @@ int main(int argc, char **argv)
 
if (argc > 1)
default_runlevel = argv[1];
+   else
+   default_runlevel = NULL;
+
+   if (default_runlevel && strcmp(default_runlevel, "reexec") == 0)
+   reexec = true;
 
printf("OpenRC init version %s starting\n", VERSION);
-   init(default_runlevel);
+   if (! reexec)
+   init(default_runlevel);
memset(&sa, 0, sizeof(sa));
sa.sa_handler = signal_handler;
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
reboot(RB_DISABLE_CAD);
 
-   if (mkfifo(RC_INIT_FIFO, 0600) == -1)
+   if (mkfifo(RC_INIT_FIFO, 0600) == -1 && errno != EEXIST)
perror("mkfifo");
 
for (;;) {
@@ -166,6 +180,8 @@ int main(int argc, char **argv)
handle_shutdown("shutdown", RB_POWER_OFF);
else if (strcmp(buf, "reboot") == 0)
handle_shutdown("reboot", RB_AUTOBOOT);
+   else if (strcmp(buf, "reexec") == 0)
+   handle_reexec(argv[0]);
}
return 0;
 }

diff --git a/src/rc/openrc-shutdown.c b/src/rc/openrc-shutdown.c
index 978e8a68..8905d354 100644
--- a/src/rc/openrc-shutdown.c
+++ b/src/rc/openrc-shutdown.c
@@ -35,11 +35,12 @@
 
 const char *applet = NULL;
 const char *extraopts = NULL;
-const char *getoptstring = "kpr" getoptstring_COMMON;
+const char *getoptstring = "HkpRr" getoptstring_COMMON;
 const struct option longopts[] = {
{ "halt",no_argument, NULL, 'H'},
{ "kexec",no_argument, NULL, 'k'},
{ "poweroff",no_argument, NULL, 'p'},
+   { "reexec",no_argument, NULL, 'R'},
{ "reboot",no_argument, NULL, 'r'},
longopts_COMMON
 };
@@ -47,11 +48,13 @@ const char * const longopts_help[] = {
"halt the system",
"reboot the system using kexec",
"power off the system",
+   "re-execute init (use after upgrading)",
"reboot the system",
longopts_help_COMMON
 };
 const char *usagestring = NULL;
-const char *exclusive = "Select one of --halt, --kexec, --poweroff or 
--reboot";
+const char *exclusive = "Select one of "
+"--halt, --kexec, --poweroff, --reexec or --reboot";
 
 static void send_cmd(const char *cmd)
 {
@@ -79,6 +82,7 @@ int main(int argc, char **argv)
bool do_kexec = false;
bool do_poweroff = fals

[gentoo-commits] proj/openrc:master commit in: man/

2016-12-05 Thread William Hubbs
commit: 3552f0ae548d68effd4411ad4080e7b13fe627c5
Author: William Hubbs  gmail  com>
AuthorDate: Mon Dec  5 18:23:37 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Dec  5 18:25:52 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3552f0ae

man/start-stop-daemon.8: clarify documentation about --pidfile option

The documentation implied that if you stop a daemon we handle multiple
pids in a pid file. This is not correct. We only handle the first pid.

X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=601540

 man/start-stop-daemon.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index 112cd5f..1506a1a 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -55,7 +55,7 @@ is used.
 .It Fl p , -pidfile Ar pidfile
 When starting, we expect the daemon to create a valid
 .Ar pidfile
-within a reasonable amount of time. When stopping we only stop the pid(s)
+within a reasonable amount of time. When stopping we only stop the first pid
 listed in the
 .Ar pidfile .
 .It Fl n , -name Ar name



[gentoo-commits] proj/openrc:master commit in: man/

2016-12-02 Thread William Hubbs
commit: 42cb84882918a0c9dd93a89d92b0b4818dfb44b8
Author: AndCycle  andcycle  idv  tw>
AuthorDate: Fri Dec  2 11:22:14 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Dec  2 16:57:10 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=42cb8488

fix manual typo

This fixes #105.

 man/openrc-run.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3c23bcc..25ec5b9 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -97,7 +97,7 @@ String describing the extra command.
 .It Ar supervisor
 Supervisor to use to monitor this daemon. If this is unset or invalid,
 start-stop-daemon will be used.
-Currently, we support s6 from scarnet software, and supervise-daemon
+Currently, we support s6 from skarnet software, and supervise-daemon
 which is a light-weight supervisor internal to OpenRC.
 To use s6, set
 supervisor=s6.



[gentoo-commits] proj/openrc:master commit in: man/

2016-09-22 Thread William Hubbs
commit: 316903fbf0da6edc067a98327c8c6cb2b3cdcf93
Author: William Hubbs  gmail  com>
AuthorDate: Thu Sep 22 15:30:41 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Sep 22 15:30:41 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=316903fb

man/openrc-run.8: typo fix

 man/openrc-run.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index d83e1cc..3c23bcc 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -183,7 +183,7 @@ in_background is yes.
 .Pp
 Keep in mind that eval is used to process chroot, command, command_args_*,
 command_user, pidfile and procname. This may affect how they are
-evvaluated depending on how they are quoted.
+evaluated depending on how they are quoted.
 .El
 .Sh DEPENDENCIES
 You should define a



[gentoo-commits] proj/openrc:master commit in: man/

2016-09-21 Thread William Hubbs
commit: 66a9788435e51e658e4ae9d3ce0d0e54ea53e4f9
Author: William Hubbs  gmail  com>
AuthorDate: Wed Sep 21 18:33:39 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Sep 21 18:33:39 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=66a97884

man/openrc-run.8: Add note about eval usage

This fixes #77.

 man/openrc-run.8 | 4 
 1 file changed, 4 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 5ec8156..d83e1cc 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -180,6 +180,10 @@ used along with in_background_fake to support re-entrant 
services.
 .It Ar in_background_fake
 Space separated list of commands which should always succeed when
 in_background is yes.
+.Pp
+Keep in mind that eval is used to process chroot, command, command_args_*,
+command_user, pidfile and procname. This may affect how they are
+evvaluated depending on how they are quoted.
 .El
 .Sh DEPENDENCIES
 You should define a



[gentoo-commits] proj/openrc:master commit in: man/, sh/

2016-09-16 Thread William Hubbs
commit: c146b966913ae80652e3be925d3aba60ed82f14d
Author: William Hubbs  gmail  com>
AuthorDate: Fri Sep 16 19:23:09 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Sep 16 19:23:09 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c146b966

Add command_progress variable

If this is set to yes, 1, true, or on, start-stop-daemon will display a
progress meter while waiting for a daemon to stop.

 man/openrc-run.8| 4 
 sh/start-stop-daemon.sh | 5 -
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 6e3b9dc..5ec8156 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -143,6 +143,10 @@ Set this to "true", "yes" or "1" (case-insensitive) if you 
want
 .Xr start-stop-daemon 8
 to force the daemon into the background. This forces the
 "--make-pidfile" and "--pidfile" options, so the pidfile variable must be set.
+.It Ar command_progress
+Set this to "true", "yes" or "1" (case-insensitive) if you want 
+.Xr start-stop-daemon 8
+to display a progress meter when waiting for a daemon to stop.
 .It Ar command_user
 If the daemon does not support changing to a different user id, you can
 use this to change the user id before

diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 6b679ac..6f396b3 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -63,6 +63,7 @@ ssd_start()
 
 ssd_stop()
 {
+   local _progress=
local startcommand="$(service_get_value "command")"
local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
@@ -72,13 +73,15 @@ ssd_stop()
pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
+   yesno "${command_progress}" && _progress=--progress
ebegin "Stopping ${name:-$RC_SVCNAME}"
start-stop-daemon --stop \
${retry:+--retry} $retry \
${command:+--exec} $command \
${procname:+--name} $procname \
${pidfile:+--pidfile} $chroot$pidfile \
-   ${stopsig:+--signal} $stopsig
+   ${stopsig:+--signal} $stopsig \
+   ${_progress}
 
eend $? "Failed to stop ${name:-$RC_SVCNAME}"
 }



[gentoo-commits] proj/openrc:master commit in: man/

2016-09-13 Thread William Hubbs
commit: a4e0d675e13f07bf880da10a4d602983a556264d
Author: William Hubbs  gmail  com>
AuthorDate: Tue Sep 13 19:02:10 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Sep 13 19:02:10 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a4e0d675

man/openrc-run.8: update variable documentation

- document command_args_background and command_user.r
- clarify documentation for command_background

This fixes #78.

 man/openrc-run.8 | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3d78d98..6e3b9dc 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -125,15 +125,31 @@ if no start or stop function is defined by the service.
 .It Ar command_args
 List of arguments to pass to the daemon when starting via
 .Nm start-stop-daemon .
+.It Ar command_args_background
+This variable should be used if the daemon you are starting with
+.Xr start-stop-daemon 8
+runs in the foreground by default but has its own command line options
+to request that it background and write a pid file. It should be set to
+those options. It should not be used at the same time as
+command_background, because command_background requests that
+.Xr start-stop-daemon 8
+go into the background before executing the daemon.
 .It Ar command_args_foreground
 List of arguments to pass to the daemon when starting via
 .Nm supervise-daemon .
 to force the daemon to stay in the foreground
 .It Ar command_background
-Set this to "true", "yes" or "1" (case-insensitive) to force the daemon into
-the background. This implies the "--make-pidfile" and "--pidfile" option of
+Set this to "true", "yes" or "1" (case-insensitive) if you want 
+.Xr start-stop-daemon 8
+to force the daemon into the background. This forces the
+"--make-pidfile" and "--pidfile" options, so the pidfile variable must be set.
+.It Ar command_user
+If the daemon does not support changing to a different user id, you can
+use this to change the user id before
 .Xr start-stop-daemon 8
-so the pidfile variable must be set.
+or
+.Xr supervise-daemon 8
+launches the daemon
 .It Ar chroot
 .Xr start-stop-daemon 8
 and



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/, etc/

2016-07-26 Thread William Hubbs
commit: 94b98430cb83a8f4e62d837100fc357e9eb12ca6
Author: Kenneth Lakin  gmail  com>
AuthorDate: Tue Nov  3 11:33:06 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jul 26 17:30:39 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=94b98430

start-stop-daemon: Add SSD_IONICELEVEL

This is the disk IO counterpart to SSD_NICELEVEL.
Modified by William Hubbs to add the variable to the start-stop-daemon
man page.

This fixes #69.

 etc/rc.conf|  3 +++
 man/start-stop-daemon.8|  4 
 src/rc/start-stop-daemon.c | 14 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/etc/rc.conf b/etc/rc.conf
index 80f68dd..cbb660a 100644
--- a/etc/rc.conf
+++ b/etc/rc.conf
@@ -117,6 +117,9 @@
 # Some daemons are started and stopped via start-stop-daemon.
 # We can set some things on a per service basis, like the nicelevel.
 #SSD_NICELEVEL="-19"
+# Or the ionice level. The format is class[:data] , just like the
+# --ionice start-stop-daemon parameter.
+#SSD_IONICELEVEL="2:2"
 
 # Pass ulimit parameters
 # If you are using bash in POSIX mode for your shell, note that the

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index c328895..112cd5f 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -153,6 +153,10 @@ The retry specification can be either a timeout in seconds 
or multiple
 signal/timeout pairs (like SIGTERM/5).
 .El
 .Sh ENVIRONMENT
+.Va SSD_IONICELEVEL
+can also set the IO scheduling priority of the daemon, but the command line
+option takes precedence.
+.Pp
 .Va SSD_NICELEVEL
 can also set the scheduling priority of the daemon, but the command line
 option takes precedence.

diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 27939c2..188169f 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -696,6 +696,17 @@ int main(int argc, char **argv)
if (sscanf(tmp, "%d", &nicelevel) != 1)
eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)",
applet, tmp);
+   if ((tmp = getenv("SSD_IONICELEVEL"))) {
+   int n = sscanf(tmp, "%d:%d", &ionicec, &ioniced);
+   if (n != 1 && n != 2)
+   eerror("%s: invalid ionice level `%s' 
(SSD_IONICELEVEL)",
+   applet, tmp);
+   if (ionicec == 0)
+   ioniced = 0;
+   else if (ionicec == 3)
+   ioniced = 7;
+   ionicec <<= 13; /* class shift */
+   }
 
/* Get our user name and initial dir */
p = getenv("USER");
@@ -1195,7 +1206,8 @@ int main(int argc, char **argv)
if ((strncmp(env->value, "RC_", 3) == 0 &&
strncmp(env->value, "RC_SERVICE=", 10) != 0 &&
strncmp(env->value, "RC_SVCNAME=", 10) != 0) ||
-   strncmp(env->value, "SSD_NICELEVEL=", 14) == 0)
+   strncmp(env->value, "SSD_NICELEVEL=", 14) == 0 
||
+   strncmp(env->value, "SSD_IONICELEVEL=", 16) == 
0)
{
p = strchr(env->value, '=');
*p = '\0';



[gentoo-commits] proj/openrc:master commit in: man/

2016-06-23 Thread William Hubbs
commit: 553799400218903ab495d1154a41c6d8890cb752
Author: Mike Gilbert  gentoo  org>
AuthorDate: Thu Jun 23 12:40:45 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Jun 23 22:46:11 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=55379940

man: Document the procname variable for openrc-run

X-Gentoo-Bug: 586794
X-Gentoo-Bug-URL: https://bugs.gentoo.org/586794

 man/openrc-run.8 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index be15d59..3d78d98 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -143,6 +143,8 @@ will chroot into this path before writing the pid file or 
starting the daemon.
 Pidfile to use for the above defined command.
 .It Ar name
 Display name used for the above defined command.
+.It Ar procname
+Process name to match when signaling the daemon.
 .It Ar stopsig
 Signal to send when stopping the daemon.
 .It Ar retry



[gentoo-commits] proj/openrc:master commit in: man/, src/rc/

2016-01-28 Thread William Hubbs
commit: 8a7e4d38a74c714e1a532e1b7a53fd2a5c528b63
Author: William Hubbs  gmail  com>
AuthorDate: Sun Sep 21 18:54:51 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Jan 28 18:57:11 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=8a7e4d38

rc-service: add --ifinactive and --ifnotstarted flags

X-Gentoo-Bug: 523174
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523174

 man/rc-service.8| 15 +++
 src/rc/rc-service.c | 20 +++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/man/rc-service.8 b/man/rc-service.8
index 9260329..80deb5e 100644
--- a/man/rc-service.8
+++ b/man/rc-service.8
@@ -20,6 +20,14 @@
 .Ar service cmd
 .Op Ar ...
 .Nm
+.Op Fl I , -ifinactive
+.Ar service cmd
+.Op Ar ...
+.Nm
+.Op Fl N , -ifnotstarted
+.Ar service cmd
+.Op Ar ...
+.Nm
 .Fl e , -exists
 .Ar service
 .Nm
@@ -36,6 +44,13 @@ If
 is given then
 .Nm
 returns 0 even if the service does not exist.
+If
+.Fl I , -ifinactive
+or
+.Fl N , -ifnotstarted
+is given then
+.Nm
+returns 0 if the service exists but is in the wrong state.
 .Pp
 If given the
 .Fl l , -list

diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 8e9da44..3fd94b2 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -29,10 +29,12 @@
 
 const char *applet = NULL;
 const char *extraopts = NULL;
-const char *getoptstring = "e:ilr:" getoptstring_COMMON;
+const char *getoptstring = "e:ilr:IN" getoptstring_COMMON;
 const struct option longopts[] = {
{ "exists",   1, NULL, 'e' },
{ "ifexists", 0, NULL, 'i' },
+   { "ifinactive", 0, NULL, 'I' },
+   { "ifnotstarted", 0, NULL, 'N' },
{ "list", 0, NULL, 'l' },
{ "resolve",  1, NULL, 'r' },
longopts_COMMON
@@ -40,6 +42,8 @@ const struct option longopts[] = {
 const char * const longopts_help[] = {
"tests if the service exists or not",
"if the service exists then run the command",
+   "if the service is inactive then run the command",
+   "if the service is not started then run the command",
"list all available services",
"resolve the service name to an init script",
longopts_help_COMMON
@@ -56,7 +60,10 @@ int main(int argc, char **argv)
char *service;
RC_STRINGLIST *list;
RC_STRING *s;
+   RC_SERVICE state;
bool if_exists = false;
+   bool if_inactive = false;
+   bool if_notstarted = false;
 
applet = basename_c(argv[0]);
/* Ensure that we are only quiet when explicitly told to be */
@@ -77,6 +84,12 @@ int main(int argc, char **argv)
case 'i':
if_exists = true;
break;
+   case 'I':
+   if_inactive = true;
+   break;
+   case 'N':
+   if_notstarted = true;
+   break;
case 'l':
list = rc_services_in_runlevel(NULL);
if (TAILQ_FIRST(list) == NULL)
@@ -113,6 +126,11 @@ int main(int argc, char **argv)
return 0;
eerrorx("%s: service `%s' does not exist", applet, *argv);
}
+   state = rc_service_state(*argv);
+   if (if_inactive && ! (state & RC_SERVICE_INACTIVE))
+   return 0;
+   if (if_notstarted && (state & RC_SERVICE_STARTED))
+   return 0;
*argv = service;
execv(*argv, argv);
eerrorx("%s: %s", applet, strerror(errno));



[gentoo-commits] proj/openrc:master commit in: man/, src/librc/

2016-01-21 Thread William Hubbs
commit: 69f052b611878d771fc3f56ee77639269db9b6e1
Author: William Hubbs  gmail  com>
AuthorDate: Thu Jan 21 21:35:55 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Jan 21 21:58:03 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=69f052b6

librc: Complain when a real and virtual service have the same name

 man/openrc-run.8 |  6 +++---
 src/librc/librc-depend.c | 26 ++
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 08012f7..b23c5fe 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -172,9 +172,9 @@ The service will start after these services and stop before 
these services.
 The service will start before these services and stop after these services.
 .It Ic provide
 The service provides this virtual service. For example, named provides dns.
-Virtual services take precedence over real services, so it is highly
-recommended that you do not have a real service that has the same name
-as a virtual service.
+Note that it is not legal to have a virtual and real service with the
+same name. If you do this, you will receive an error message, and you
+must rename either the real or virtual service.
 .It Ic config
 We should recalculate our dependencies if the listed files have changed.
 .It Ic keyword

diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index d64b2b2..1c99399 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -717,14 +717,16 @@ rc_deptree_update_needed(time_t *newest, char *file)
 }
 librc_hidden_def(rc_deptree_update_needed)
 
-/* This is a 6 phase operation
+/* This is a 7 phase operation
Phase 1 is a shell script which loads each init script and config in turn
and echos their dependency info to stdout
Phase 2 takes that and populates a depinfo object with that data
Phase 3 adds any provided services to the depinfo object
Phase 4 scans that depinfo object and puts in backlinks
Phase 5 removes broken before dependencies
-   Phase 6 saves the depinfo object to disk
+   Phase 6 looks for duplicate services indicating a real and virtual service
+   with the same names
+   Phase 7 saves the depinfo object to disk
*/
 bool
 rc_deptree_update(void)
@@ -733,7 +735,7 @@ rc_deptree_update(void)
RC_DEPTREE *deptree, *providers;
RC_DEPINFO *depinfo = NULL, *depinfo_np, *di;
RC_DEPTYPE *deptype = NULL, *dt_np, *dt, *provide;
-   RC_STRINGLIST *config, *types, *sorted, *visited;
+   RC_STRINGLIST *config, *dupes, *types, *sorted, *visited;
RC_STRING *s, *s2, *s2_np, *s3, *s4;
char *line = NULL;
size_t len = 0;
@@ -742,6 +744,7 @@ rc_deptree_update(void)
bool retval = true;
const char *sys = rc_sys();
struct utsname uts;
+   int serrno;
 
/* Some init scripts need RC_LIBEXECDIR to source stuff
   Ideally we should be setting our full env instead */
@@ -996,7 +999,22 @@ rc_deptree_update(void)
}
rc_stringlist_free(types);
 
-   /* Phase 6 - save to disk
+   /* Phase 6 - Print errors for duplicate services */
+   dupes = rc_stringlist_new();
+   TAILQ_FOREACH(depinfo, deptree, entries) {
+   serrno = errno;
+   errno = 0;
+   rc_stringlist_addu(dupes,depinfo->service);
+   if (errno == EEXIST) {
+   fprintf(stderr,
+   "Error: %s is the name of a real and 
virtual service.\n",
+   depinfo->service);
+   }
+   errno = serrno;
+   }
+   rc_stringlist_free(dupes);
+
+   /* Phase 7 - save to disk
   Now that we're purely in C, do we need to keep a shell parseable 
file?
   I think yes as then it stays human readable
   This works and should be entirely shell parseable provided that 
depend



[gentoo-commits] proj/openrc:master commit in: man/

2015-12-03 Thread William Hubbs
commit: b810473e4f7218afbb7047890860c15a8c45472b
Author: William Hubbs  gmail  com>
AuthorDate: Thu Dec  3 23:37:38 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Dec  3 23:37:38 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b810473e

man/openrc-run.8: Clarify documentation on dependencies and keywords

Provide an example of using the -containers keyword and clarify
documentation on some of the dependency functions.

 man/openrc-run.8 | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 5d18fe5..bbb8b50 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -166,23 +166,25 @@ will start and stop it in the right order in relation to 
other services.
 As it's a function it can be very flexible, see the example below.
 Here is a list of the functions you can use in a
 .Ic depend
-function. You simply pass the names of the services to it to add to that
-dependency type, or prefix it with ! to remove it.
+function. You simply pass the names of the services you want to add to
+that dependency type to the function, or prefix the names with ! to
+remove them from the dependencies.
 .Bl -tag -width "RC_DEFAULTLEVEL"
 .It Ic need
 The service will refuse to start until needed services have started and it
 will refuse to stop until any services that need it have stopped.
 .It Ic use
-The service will attempt to start any services we use that have been added
+The service will attempt to start any services it uses that have been added
 to the runlevel.
 .It Ic want
-The service will attempt to start any services we want.
+The service will attempt to start any services it wants, regardless of
+whether they have been added to the runlevel.
 .It Ic after
 The service will start after these services and stop before these services.
 .It Ic before
 The service will start before these services and stop after these services.
 .It Ic provide
-We provide this virtual service. For example, named provides dns.
+The service provides this virtual service. For example, named provides dns.
 Virtual services take precedence over real services, so it is highly
 recommended that you do not have a real service that has the same name
 as a virtual service.
@@ -471,6 +473,9 @@ rc_net_tap1_provide="!net"
 # It's also possible to negate keywords. This is mainly useful for prefix
 # users testing OpenRC.
 rc_keyword="!-prefix"
+# This can also be used to block a script from runining in all
+# containers except one or two
+rc_keyword="!-containers !-docker"
 .Ed
 .Sh EXAMPLES
 .Pp



[gentoo-commits] proj/openrc:master commit in: man/, src/librc/, sh/, src/rc/

2015-11-12 Thread William Hubbs
commit: 33d3f33b3ca7dd2ce616b8182d588d0743c2f124
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Mon Oct 26 19:20:58 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Nov 12 18:32:45 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=33d3f33b

Implement "want" dependency

The want dependency is similar to the use dependency. If a service
script, for example called service1, adds "want service2" to its depend
function, OpenRC will attempt to start service2, if it exists on the
system,  when service1 is started.

However, service1 will start regardless of the status of
service2.

X-Gentoo-Bug: 406021
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406021

 man/openrc-run.8 |  2 ++
 sh/gendepends.sh.in  |  3 +++
 sh/openrc-run.sh.in  |  3 +++
 src/librc/librc-depend.c |  8 +-
 src/rc/openrc-run.c  | 66 ++--
 src/rc/rc-status.c   |  3 ++-
 src/rc/rc.c  | 34 +
 7 files changed, 77 insertions(+), 42 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 4637fd0..12c1919 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -175,6 +175,8 @@ will refuse to stop until any services that need it have 
stopped.
 .It Ic use
 The service will attempt to start any services we use that have been added
 to the runlevel.
+.It Ic want
+The service will attempt to start any services we want.
 .It Ic after
 The service will start after these services and stop before these services.
 .It Ic before

diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in
index dfe7444..36caeb7 100644
--- a/sh/gendepends.sh.in
+++ b/sh/gendepends.sh.in
@@ -16,6 +16,9 @@ need() {
 use() {
[ -n "$*" ] && echo "$RC_SVCNAME iuse $*" >&3
 }
+want() {
+   [ -n "$*" ] && echo "$RC_SVCNAME iwant $*" >&3
+}
 before() {
[ -n "$*" ] && echo "$RC_SVCNAME ibefore $*" >&3
 }

diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 749af2c..c169204 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -66,6 +66,9 @@ need() {
 use() {
[ -n "$*" ] && echo "use $*"
 }
+want() {
+   [ -n "$*" ] && echo "want $*"
+}
 before() {
[ -n "$*" ] && echo "before $*"
 }

diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index d7a8ae1..c9c06ad 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -192,7 +192,9 @@ valid_service(const char *runlevel, const char *service, 
const char *type)
 
if (!runlevel ||
strcmp(type, "ineed") == 0 ||
-   strcmp(type, "needsme") == 0)
+   strcmp(type, "needsme") == 0  ||
+   strcmp(type, "iwant") == 0 ||
+   strcmp(type, "wantsme") == 0)
return true;
 
if (rc_service_in_runlevel(service, runlevel))
@@ -543,6 +545,7 @@ rc_deptree_order(const RC_DEPTREE *deptree, const char 
*runlevel, int options)
types = rc_stringlist_new();
rc_stringlist_add(types, "ineed");
rc_stringlist_add(types, "iuse");
+   rc_stringlist_add(types, "iwant");
rc_stringlist_add(types, "iafter");
services = rc_deptree_depends(deptree, types, list, runlevel,
  RC_DEP_STRICT | RC_DEP_TRACE | options);
@@ -648,6 +651,7 @@ typedef struct deppair
 static const DEPPAIR deppairs[] = {
{ "ineed",  "needsme" },
{ "iuse",   "usesme" },
+   { "iwant",  "wantsme" },
{ "iafter", "ibefore" },
{ "ibefore","iafter" },
{ "iprovide",   "providedby" },
@@ -844,6 +848,7 @@ rc_deptree_update(void)
/* If we're after something, remove us from the before 
list */
if (strcmp(type, "iafter") == 0 ||
strcmp(type, "ineed") == 0 ||
+   strcmp(type, "iwant") == 0 ||
strcmp(type, "iuse") == 0) {
if ((dt = get_deptype(depinfo, "ibefore")))
rc_stringlist_delete(dt->services, 
depend);
@@ -957,6 +962,7 @@ rc_deptree_update(void)
/* Phase 5 - Remove broken before directives */
types = rc_stringlist_new();
rc_stringlist_add(types, "ineed");
+   rc_stringlist_add(types, "iwant");
rc_stringlist_add(types, "iuse");
rc_stringlist_add(types, "iafter");
TAILQ_FOREACH(depinfo, deptree, entries) {

diff --git a/src/rc/openrc-run.c b/src/rc/openrc-run.c
index 2af95ec..ccdaddf 100644
--- a/src/rc/openrc-run.c
+++ b/src/rc/openrc-run.c
@@ -78,19 +78,23 @@ static const char *applet;
 static char *service, *runlevel, *ibsave, *prefix;
 static RC_DEPTREE *deptree;
 static RC_STRINGLIST *applet_list, *services, *tmplist;
-static RC_STRINGLIST *restart_services, *need_services, *use_services;
+static RC_STRINGLIST *restart_services;
+static RC_STRINGLIST *need_services;
+static RC_STRINGLIST 

[gentoo-commits] proj/openrc:master commit in: man/

2015-05-27 Thread William Hubbs
commit: bcb9c44e73ccf332c7c961a6f82520699c6e776d
Author: Mike Gilbert  gentoo  org>
AuthorDate: Tue May 19 01:23:11 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed May 27 19:09:45 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bcb9c44e

man: Document the stopsig variable

This variable can be used to set the signal to send if the service is
using start-stop-daemon.

This fixes #56

 man/openrc-run.8 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index f08ad79..4637fd0 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -141,6 +141,8 @@ will chroot into this path before writing the pid file or 
starting the daemon.
 Pidfile to use for the above defined command.
 .It Ar name
 Display name used for the above defined command.
+.It Ar stopsig
+Signal to send when stopping the daemon.
 .It Ar retry
 Retry schedule to use when stopping the daemon. It can either be a
 timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5).



[gentoo-commits] proj/openrc:master commit in: man/, /, sh/, init.d/

2015-05-11 Thread William Hubbs
commit: bb2d7becfd3008379f8f69b5d036922281aa211f
Author: William Hubbs  gmail  com>
AuthorDate: Mon May 11 23:07:28 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon May 11 23:36:49 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bb2d7bec

Add support for the s6 supervision suite

 init.d/Makefile |  2 +-
 init.d/s6-svscan.in | 31 +
 man/openrc-run.8| 12 
 s6-guide.md | 56 +
 sh/Makefile |  2 +-
 sh/openrc-run.sh.in |  4 
 sh/s6.sh| 46 +++
 7 files changed, 151 insertions(+), 2 deletions(-)

diff --git a/init.d/Makefile b/init.d/Makefile
index 0bd3651..a662f8d 100644
--- a/init.d/Makefile
+++ b/init.d/Makefile
@@ -3,7 +3,7 @@ include ../mk/net.mk
 DIR=   ${INITDIR}
 SRCS=  bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \
netmount.in osclock.in root.in savecache.in swap.in swapfiles.in \
-   tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}}
+   tmpfiles.setup.in swclock.in sysctl.in urandom.in s6-svscan.in 
${SRCS-${OS}}
 BIN=   ${OBJS}
 
 # Are we installing our network scripts?

diff --git a/init.d/s6-svscan.in b/init.d/s6-svscan.in
new file mode 100644
index 000..6fdf4e1
--- /dev/null
+++ b/init.d/s6-svscan.in
@@ -0,0 +1,31 @@
+#!@SBINDIR@/openrc-run
+# Copyright (C) 2015 William Hubbs 
+# Released under the 2-clause BSD license.
+
+command=/bin/s6-svscan
+command_args="${RC_SVCDIR}"/s6-scan
+command_background=yes
+pidfile=/var/run/s6-svscan.pid
+
+depend()
+{
+   need localmount
+}
+
+start_pre()
+{
+   einfo "Creating s6 scan directory"
+   checkpath -d -m 0755 "$RC_SVCDIR"/s6-scan
+   return $?
+}
+
+stop_post()
+{
+   ebegin "Stopping any remaining s6 services"
+   s6-svc -dx "${RC_SVCDIR}"/s6-scan/* 2>/dev/null || true
+   eend $?
+
+   ebegin "Stopping any remaining s6 service loggers"
+   s6-svc -dx "${RC_SVCDIR}"/s6-scan/*/log 2>/dev/null || true
+   eend $?
+}

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index f144152..259d23f 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -107,6 +107,18 @@ the service has already been stopped.
 String describing the service.
 .It Ar description_$command
 String describing the extra command.
+.It Ar supervisor
+Supervisor to use to monitor this daemon. If this is unset,
+start-stop-daemon will be used. The only alternate supervisor we support
+in this release is S6 from Skarnet software. To use this, set
+supervisor=s6.
+.It Ar s6_service_path
+The path to the s6 service directory if you are monitoring this service
+with S6. The default is /etc/svc.d/${RC_SVCNAME}.
+.It Ar s6_svwait_options_start
+The options to pass to s6-svwait when starting the service via s6.
+.It Ar s6_svwait_options_stop
+The options to pass to s6-svwait when stopping the service via s6.
 .It Ar start_stop_daemon_args
 List of arguments passed to start-stop-daemon when starting the daemon.
 .It Ar command

diff --git a/s6-guide.md b/s6-guide.md
new file mode 100644
index 000..4a37a9c
--- /dev/null
+++ b/s6-guide.md
@@ -0,0 +1,56 @@
+# Using S6 with OpenRC
+
+Beginning with OpenRC-0.16, we support using the s6 supervision suite
+from Skarmet Software in place of start-stop-daemon for monitoring
+daemons [1].
+
+## Setup
+
+Documenting s6 in detail is beyond the scope of this guide. It will
+document how to set up OpenRC services to communicate with s6.
+
+### Use Default start, stop and status functions
+
+If you write your own start, stop and status functions in your service
+script, none of this will work. You must allow OpenRC to use the default
+functions.
+
+### Dependencies
+
+All OpenRC service scripts that want their daemons monitored by s6
+should have the following line added to their dependencies to make sure
+the s6 scan directory is being monitored.
+
+need s6-svscan
+
+### Variable Settings
+
+The most important setting is the supervisor variable. At the top of
+your service script, you should set this variable as follows:
+
+supervisor=s6
+
+Several other variables affect s6 services. They are documented on the
+openrc-run man page, but I will list them here for convenience:
+
+s6_service_path - the path to the s6 service directory
+s6_svwait_options_start - the options to pass to s6-svwait when starting
+s6_svwait_options_stop - the options to pass to s6-svwait when stopping.
+
+The s6_service_path variable defaults to /etc/svc.d/${RC_SVCNAME} if it
+is not set in the service script. For example, if you want a service
+script called /etc/init.d/foobar to use s6 to monitor its daemon, the s6
+service should be the directory /etc/svc.d/foobar.
+
+See the documentation for s6 for more information about s6 service
+directories.
+
+The s6_svwait_options_* variables set command line options to pass to
+s6-svwait when starting or stopping the s6 serv

[gentoo-commits] proj/openrc:master commit in: man/

2015-05-11 Thread William Hubbs
commit: 0f9354becfbd54f9800c93092aa26be859dcf16a
Author: William Hubbs  gmail  com>
AuthorDate: Mon May 11 20:37:30 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon May 11 20:37:30 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0f9354be

man: Clarify the documentation for command_args

The command_args variable only works if using start-stop-daemon to start
the daemon.

 man/openrc-run.8 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3308f24..f144152 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -114,7 +114,8 @@ Daemon to start or stop via
 .Nm start-stop-daemon
 if no start or stop function is defined by the service.
 .It Ar command_args
-List of arguments to pass to the daemon when starting.
+List of arguments to pass to the daemon when starting via
+.Nm start-stop-daemon .
 .It Ar command_background
 Set this to "true", "yes" or "1" (case-insensitive) to force the daemon into
 the background. This implies the "--make-pidfile" and "--pidfile" option of



[gentoo-commits] proj/openrc:master commit in: man/

2014-11-22 Thread William Hubbs
commit: dff6e4a004afeaa64f4ccb07c7d31bb821b043b4
Author: S. Gilles  umd  edu>
AuthorDate: Sat Nov 22 17:41:10 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Sat Nov 22 17:49:46 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=dff6e4a0

Fix mdoc warning for empty line in rc-update man page.

X-Gentoo-Bug: 529374
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=529374

---
 man/rc-update.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/rc-update.8 b/man/rc-update.8
index dca4b90..113a533 100644
--- a/man/rc-update.8
+++ b/man/rc-update.8
@@ -87,7 +87,7 @@ If the
 .Fl s , -stack
 option is given then we either add or remove the runlevel from the runlevel.
 This allows inheritance of runlevels.
-
+.Pp
 If the
 .Fl a, -all
 option is given, we remove the service from all runlevels. This is



[gentoo-commits] proj/openrc:master commit in: man/

2014-09-19 Thread William Hubbs
commit: 20006625a6d37c5add84dd4c8454649279645604
Author: William Hubbs  gmail  com>
AuthorDate: Fri Sep 19 22:23:55 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Sep 19 22:23:55 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=20006625

man: Document start_inactive and in_background_fake

---
 man/openrc-run.8 | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 3890f76..c8bf24d 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -131,6 +131,12 @@ timeout in seconds or multiple signal/timeout pairs (like 
SIGTERM/5).
 A list of directories which must exist for the service to start.
 .It Ar required_files
 A list of files which must exist for the service to start.
+.It Ar start_inactive
+Set to yes to have the service marked inactive when it starts. This is
+used along with in_background_fake to support re-entrant services.
+.It Ar in_background_fake
+Space separated list of commands which should always succeed when
+in_background is yes.
 .El
 .Sh DEPENDENCIES
 You should define a



[gentoo-commits] proj/openrc:master commit in: man/

2014-07-13 Thread William Hubbs
commit: 40141244e349e6e1d2dfb9ebfbcbf62f68d33a9d
Author: William Hubbs  gmail  com>
AuthorDate: Sun Jul 13 16:15:26 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Sun Jul 13 16:23:43 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=40141244

man/openrc-run.8: more updates and clarifications for checkpath

X-Gentoo-Bug: 500606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606

---
 man/openrc-run.8 | 39 ++-
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 07f3527..3890f76 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -322,30 +322,35 @@ Mark the service as inactive.
 .Op Fl p , -pipe
 .Op Fl m , -mode Ar mode
 .Op Fl o , -owner Ar owner
+.Op Fl W , -writable
 .Op Fl q , -quiet
 .Ar path ...
 .Xc
-Checks to see if the path exists, is of the right type, owned by the right
-people and has the correct access modes. If not, then it corrects the path.
+If -d, -f or -p is specified, checkpath checks to see if the path
+exists, is the right type and has the correct owner and access modes. If
+any of these tests fail, the path is created and set up as specified. If
+more than one of -d, -f or -p are specified, the last one will be used.
 
-Type.
-File, directory and pipe types are supported, if type is not provided then
-directory is used
+The argument to -m is a three or four digit octal number. If this option
+is not provided, the value defaults to 0644 for files and 0775 for
+directories.
 
-Mode.
-Mode should be provided as a three (644) or four digit string (0644). If mode
-is argument is not provided then default value is used: 0644 - for files, and
-0775 for directories.
+The argument to -o is a representation of the user and/or group which
+should own the path. The user and group can be represented numerically
+or with names, and are separated by a colon.
 
-Truncate variant of options create empty directory or file, or clears contents
-if it exists.
+The truncate options (-D and -F) cause the directory or file to be
+cleared of all contents.
 
-Quiet argument suppress normal output, repeat quiet argument to suppress 
errors.
-.It Ic checkpath
-.Op Fl W , -writable
-.Ar path
-.Xc
-checks to see if the path is writable.
+If -W is specified, checkpath checks to see if the first path given on
+the command line is writable.  This is different from how the test
+command in the shell works, because it also checks to make sure the file
+system is not read only.
+
+Also, the -d, -f or -p options should not be specified along with this option.
+
+The -q option suppresses all informational output. If it is specified
+twice, all error messages are suppressed as well.
 .It Ic yesno Ar value
 If
 .Ar value



[gentoo-commits] proj/openrc:master commit in: man/

2014-07-13 Thread William Hubbs
commit: d59737afb159d993916836903d9e670a1334c93a
Author: Alexander V Vershilov  gentoo  org>
AuthorDate: Sun Feb 16 00:08:23 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Sun Jul 13 13:50:36 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=d59737af

man/openrc.8: update checkpath documentation

X-GENTOO-BUG: 500606
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606

---
 man/openrc-run.8 | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 0ce1f75..07f3527 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -322,10 +322,25 @@ Mark the service as inactive.
 .Op Fl p , -pipe
 .Op Fl m , -mode Ar mode
 .Op Fl o , -owner Ar owner
+.Op Fl q , -quiet
 .Ar path ...
 .Xc
 Checks to see if the path exists, is of the right type, owned by the right
 people and has the correct access modes. If not, then it corrects the path.
+
+Type.
+File, directory and pipe types are supported, if type is not provided then
+directory is used
+
+Mode.
+Mode should be provided as a three (644) or four digit string (0644). If mode
+is argument is not provided then default value is used: 0644 - for files, and
+0775 for directories.
+
+Truncate variant of options create empty directory or file, or clears contents
+if it exists.
+
+Quiet argument suppress normal output, repeat quiet argument to suppress 
errors.
 .It Ic checkpath
 .Op Fl W , -writable
 .Ar path



[gentoo-commits] proj/openrc:master commit in: man/

2014-07-11 Thread William Hubbs
commit: f66f41c4f03d8077bdaa047a7a93f6c92c0a69de
Author: Alexander V Vershilov  gentoo  org>
AuthorDate: Fri Jul 11 21:33:42 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jul 11 21:36:35 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f66f41c4

typo fix

---
 man/openrc-run.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index c330e8c..0ce1f75 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -321,7 +321,7 @@ Mark the service as inactive.
 .Op Fl f , -file
 .Op Fl p , -pipe
 .Op Fl m , -mode Ar mode
-.Op Fl o , owner Ar owner
+.Op Fl o , -owner Ar owner
 .Ar path ...
 .Xc
 Checks to see if the path exists, is of the right type, owned by the right



[gentoo-commits] proj/openrc:master commit in: man/

2014-06-21 Thread William Hubbs
commit: 23cb55d843b165d5508f330287ed329358fc85dc
Author: William Hubbs  gmail  com>
AuthorDate: Sat Jun 21 06:53:17 2014 +
Commit: William Hubbs  gentoo  org>
CommitDate: Sat Jun 21 06:53:17 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=23cb55d8

man/start-stop-daemon.8: correct argument from --nice to --nicelevel

X-Gentoo-Bug: 510648
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=510648

---
 man/start-stop-daemon.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index a805232..b3405d5 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -139,7 +139,7 @@ option.
 Modifies the IO scheduling priority of the daemon.
 Class can be 0 for none, 1 for real time, 2 for best effort and 3 for idle.
 Data can be from 0 to 7 inclusive.
-.It Fl N , -nice Ar level
+.It Fl N , -nicelevel Ar level
 Modifies the scheduling priority of the daemon.
 .It Fl 1 , -stdout Ar logfile
 Redirect the standard output of the process to logfile when started with