Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: sh/, man/
Date: Wed, 29 Nov 2017 21:12:43
Message-Id: 1511989566.ddbdb696582e9fd61995f15d6a3a53055a151e41.williamh@OpenRC
1 commit: ddbdb696582e9fd61995f15d6a3a53055a151e41
2 Author: Julien Reichardt <mi <AT> jrei <DOT> ch>
3 AuthorDate: Mon Nov 20 22:45:51 2017 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 29 21:06:06 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ddbdb696
7
8 add more variables for start-stop-daemon and supervise-daemon options
9
10 Add the following variables to expose more arguments that can be passed
11 to start-stop-daemon or supervise-daemon:
12
13 - directory will be passed to --chdir
14 - error_log will be passed to --stderr
15 - output_log will be passed to --stdout
16 - umask will be passed to umask
17
18 This is for #184.
19
20 man/openrc-run.8 | 20 ++++++++++++++++++++
21 sh/start-stop-daemon.sh | 4 ++++
22 sh/supervise-daemon.sh | 4 ++++
23 3 files changed, 28 insertions(+)
24
25 diff --git a/man/openrc-run.8 b/man/openrc-run.8
26 index 3f4f7e81..e1db58bd 100644
27 --- a/man/openrc-run.8
28 +++ b/man/openrc-run.8
29 @@ -157,6 +157,24 @@ use this to change the user id before
30 or
31 .Xr supervise-daemon 8
32 launches the daemon
33 +.It Ar output_log
34 +This is the path to a file or named pipe where the standard output from
35 +the service will be redirected. If you are starting this service with
36 +.Xr start-stop-daemon 8 ,
37 +, you must set
38 +.Pa command_background
39 +to true. Keep in mind that this path will be inside the chroot if the
40 +.Pa chroot
41 +variable is set.
42 +.It Ar error_log
43 +The same thing as
44 +.Pa output_log
45 +but for the standard error output.
46 +.It Ar directory
47 +.Xr start-stop-daemon 8
48 +and
49 +.Xr supervise-daemon 8
50 +will chdir to this directory before starting the daemon.
51 .It Ar chroot
52 .Xr start-stop-daemon 8
53 and
54 @@ -201,6 +219,8 @@ used along with in_background_fake to support re-entrant services.
55 .It Ar in_background_fake
56 Space separated list of commands which should always succeed when
57 in_background is yes.
58 +.It Ar umask
59 +Set the umask of the daemon.
60 .Pp
61 Keep in mind that eval is used to process chroot, command, command_args_*,
62 command_user, pidfile and procname. This may affect how they are
63
64 diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
65 index 0793b19a..35c642c0 100644
66 --- a/sh/start-stop-daemon.sh
67 +++ b/sh/start-stop-daemon.sh
68 @@ -44,9 +44,13 @@ ssd_start()
69 eval start-stop-daemon --start \
70 --exec $command \
71 ${chroot:+--chroot} $chroot \
72 + ${directory:+--chdir} $directory \
73 + ${output_log+--stdout} $output_log \
74 + ${error_log+--stderr} $error_log \
75 ${procname:+--name} $procname \
76 ${pidfile:+--pidfile} $pidfile \
77 ${command_user+--user} $command_user \
78 + ${umask+--umask} $umask \
79 $_background $start_stop_daemon_args \
80 -- $command_args $command_args_background
81 if eend $? "Failed to start ${name:-$RC_SVCNAME}"; then
82
83 diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
84 index f6e599d5..b600b9c6 100644
85 --- a/sh/supervise-daemon.sh
86 +++ b/sh/supervise-daemon.sh
87 @@ -24,12 +24,16 @@ supervise_start()
88 # to work properly.
89 eval supervise-daemon "${RC_SVCNAME}" --start \
90 ${retry:+--retry} $retry \
91 + ${directory:+--chdir} $directory \
92 ${chroot:+--chroot} $chroot \
93 + ${output_log+--stdout} ${output_log} \
94 + ${error_log+--stderr} $error_log \
95 ${pidfile:+--pidfile} $pidfile \
96 ${respawn_delay:+--respawn-delay} $respawn_delay \
97 ${respawn_max:+--respawn-max} $respawn_max \
98 ${respawn_period:+--respawn-period} $respawn_period \
99 ${command_user+--user} $command_user \
100 + ${umask+--umask} $umask \
101 $supervise_daemon_args \
102 $command \
103 -- $command_args $command_args_foreground