summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-08-17 08:04:20 +0000
committeryar <yar@FreeBSD.org>2006-08-17 08:04:20 +0000
commitd5c64fa9978f9563be3ef34f9a3ce051d3ef4fad (patch)
tree4fff779c2029f5e34bbecca02bf1a4d22615f26b /etc/rc.subr
parentf6a5a99700b928757687a9c8b9a4c3c88985613a (diff)
downloadFreeBSD-src-d5c64fa9978f9563be3ef34f9a3ce051d3ef4fad.zip
FreeBSD-src-d5c64fa9978f9563be3ef34f9a3ce051d3ef4fad.tar.gz
Allow for setting negative priority (niceness) when $foo_user is non-root.
The order in _doit must be "nice su", not "su nice", for that. In addition, don't ignore the exit status from "cd $foo_chdir". Reviewed by: freebsd-rc (silence) MFC after: 1 week
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr9
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index f89c699..c20cd43 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -666,12 +666,17 @@ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
$_chroot $command $rc_flags $command_args"
else
_doit="\
-${_chdir:+cd $_chdir; }\
-${_nice:+nice -n $_nice }\
+${_chdir:+cd $_chdir && }\
$command $rc_flags $command_args"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
fi
+ if [ -n "$_nice" ]; then
+ if [ -z "$_user" ]; then
+ _doit="sh -c \"$_doit\""
+ fi
+ _doit="nice -n $_nice $_doit"
+ fi
fi
# run the full command;
OpenPOWER on IntegriCloud