aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2009-03-06 10:51:54 -0500
committerBill Nottingham <notting@redhat.com>2009-03-06 10:51:54 -0500
commite9e94d1d34f768a7aa316fba63da21b5693f3e0c (patch)
tree51eebb0a9a8ecfd42919b7383e42d04cc34b996d
parentbcb7572fe42c8efb712e5124f25935568c951103 (diff)
downloadinitscripts-e9e94d1d34f768a7aa316fba63da21b5693f3e0c.tar
initscripts-e9e94d1d34f768a7aa316fba63da21b5693f3e0c.tar.gz
initscripts-e9e94d1d34f768a7aa316fba63da21b5693f3e0c.tar.bz2
initscripts-e9e94d1d34f768a7aa316fba63da21b5693f3e0c.tar.xz
initscripts-e9e94d1d34f768a7aa316fba63da21b5693f3e0c.zip
cgroup support (<jsafrane@redhat.com>)
-rw-r--r--rc.d/init.d/functions19
1 files changed, 17 insertions, 2 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 37ec2865..fe9dd3a3 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -181,6 +181,7 @@ daemon() {
# Test syntax.
local gotbase= force= nicelevel corelimit
local pid base= user= nice= bg= pid_file=
+ local cgroup=
nicelevel=0
while [ "$1" != "${1##[-+]}" ]; do
case $1 in
@@ -239,15 +240,29 @@ daemon() {
# if they set NICELEVEL in /etc/sysconfig/foo, honor it
[ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL"
+ # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it
+ if [ -n "${CGROUP_DAEMON}" ]; then
+ if [ ! -x /usr/bin/cgexec ]; then
+ echo -n "Cgroups not installed"; warning
+ echo
+ else
+ cgroup="/usr/bin/cgexec";
+ for i in $CGROUP_DAEMON; do
+ cgroup="$cgroup -g $i";
+ done
+ fi
+ fi
+
# Echo daemon
[ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base"
# And start it up.
if [ -z "$user" ]; then
- $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*"
+ $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*"
else
- $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $*"
+ $cgroup $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $*"
fi
+
[ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
}