Browse Source

Add support for setting _user _class and _shell for a specific daemon,

and use su to start the daemons.
By default if there is no class defined, daemon will be used. For a shell
it defaults to /bin/sh.
OPENBSD_4_9
robert 14 years ago
parent
commit
b8cf932a14
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/etc/rc.d/rc.subr

+ 6
- 2
src/etc/rc.d/rc.subr View File

@ -1,4 +1,4 @@
# $OpenBSD: rc.subr,v 1.8 2010/10/28 21:36:45 robert Exp $
# $OpenBSD: rc.subr,v 1.9 2010/12/10 21:25:50 robert Exp $
[ -z "${local_rcconf}" ] && . /etc/rc.conf [ -z "${local_rcconf}" ] && . /etc/rc.conf
@ -9,7 +9,8 @@ rc_err() {
rc_start() { rc_start() {
type rc_pre >/dev/null && rc_pre type rc_pre >/dev/null && rc_pre
${daemon} ${daemon_flags} >/dev/null
su -c ${_rcclass:-daemon} -s ${_rcshell:-/bin/sh} \
${_rcuser:-root} -c "${daemon} ${daemon_flags}" >/dev/null
} }
rc_check() { rc_check() {
@ -28,6 +29,9 @@ rc_stop() {
rc_cmd() { rc_cmd() {
_name=`basename $0` _name=`basename $0`
eval _rcflags=\${${_name}_flags} eval _rcflags=\${${_name}_flags}
eval _rcuser=\${${_name}_user}
eval _rcclass=\${${_name}_class}
eval _rcshell=\${${_name}_shell}
[ `id -u` -eq 0 -o X"$1" = "Xcheck" ] || \ [ `id -u` -eq 0 -o X"$1" = "Xcheck" ] || \
rc_err "$0: need root privileges" rc_err "$0: need root privileges"


Loading…
Cancel
Save