Hello community,

here is the log from the commit of package libcgroup1 for openSUSE:Factory
checked in at Fri Feb 25 11:49:25 CET 2011.



--------
--- libcgroup1/libcgroup1.changes       2010-07-05 22:18:17.000000000 +0200
+++ /mounts/work_src_done/STABLE/libcgroup1/libcgroup1.changes  2011-01-12 
17:02:02.000000000 +0100
@@ -1,0 +2,22 @@
+Wed Jan 12 16:15:05 CET 2011 - [email protected]
+
+- sync cgconfig and cgred init.d scripts with upstream
+- man pages fixes
+
+-------------------------------------------------------------------
+Tue Jan  4 11:45:34 CET 2011 - [email protected]
+
+- update cgconfig and cgred init.d scripts
+- fix segfault in cgconfigparser
+
+-------------------------------------------------------------------
+Mon Dec 20 09:47:28 CEST 2010 - [email protected]
+
+- update to 0.37
+  - init scripts fixes
+  - add new tools (scripts need not to do much work)
+  - fixes in what tools and scripts return
+  - many memory leaks fixed
+  - other small fixes
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  initd_cgconfig
  initd_cgred
  libcgroup-0.36.2.tar.bz2

New:
----
  0001-docco-fixes.patch
  0003-scripts-init.d-cgconfig-cleanup.patch
  0004-scripts-init.d-little-cleanup-cgred.in.patch
  0005-configure.in-fix-autoconf-error.patch
  0006-scripts-set-executable-the-init-scripts.patch
  initd_cgconfig.patch
  initd_cgred.patch
  libcgroup-0.37_20110110.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libcgroup1.spec ++++++
--- /var/tmp/diff_new_pack.tSuuKF/_old  2011-02-25 11:48:33.000000000 +0100
+++ /var/tmp/diff_new_pack.tSuuKF/_new  2011-02-25 11:48:33.000000000 +0100
@@ -1,7 +1,7 @@
 #
-# spec file for package libcgroup1 (Version 0.36.2)
+# spec file for package libcgroup1
 #
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,18 +19,23 @@
 
 
 Name:           libcgroup1
-Version:        0.36.2
-Release:        2
+Version:        0.37_20110110
+Release:        1
 License:        LGPLv2.1
 Group:          System/Management
 AutoReqProv:    on
 Summary:        Control groups management tools
 Url:            http://sourceforge.net/projects/libcg/
 Source:         
http://dl.sourceforge.net/sourceforge/libcg/libcgroup-%{version}.tar.bz2
-Source1:        initd_cgconfig
-Source2:        initd_cgred
 Source3:        sysconfig.cgred
 Source99:       baselibs.conf
+Patch0:         0001-docco-fixes.patch
+Patch1:         0003-scripts-init.d-cgconfig-cleanup.patch
+Patch2:         0004-scripts-init.d-little-cleanup-cgred.in.patch
+Patch3:         0005-configure.in-fix-autoconf-error.patch
+Patch4:         0006-scripts-set-executable-the-init-scripts.patch
+Patch5:         initd_cgconfig.patch
+Patch6:         initd_cgred.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  bison flex gcc-c++ pam-devel pkg-config
 Requires:       insserv pam
@@ -69,19 +74,31 @@
 
 %prep
 %setup -n libcgroup-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 %build
-%configure --enable-pam-module-dir=/%{_lib}/security
+# only for GIT builds
+aclocal
+libtoolize -c
+autoconf
+autoheader
+automake --foreign --add-missing --copy
+# ==============
+
+%configure --enable-pam-module-dir=/%{_lib}/security 
--enable-initscript-install
 export V=1
-make
+make %{?_smp_mflags}
 
 %install
-%makeinstall
+%makeinstall INITSCRIPTDIR=%{buildroot}/%{_sysconfdir}/init.d/
 find $RPM_BUILD_ROOT -type f -name '*.la' -exec rm -f {} ';'
 rm -f $RPM_BUILD_ROOT/%{_lib}/security/*.so.* 
-mkdir -p %{buildroot}/%{_sysconfdir}/init.d/
-install -m 755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/cgconfig
-install -m 755 %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/cgred
 mkdir -p %{buildroot}/%{_localstatedir}/adm/fillup-templates/
 install -m 644 %{SOURCE3} 
%{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.cgred
 

++++++ 0001-docco-fixes.patch ++++++
>From b97e25e9cb8bfa54db22d3787fe4853c00e62fc6 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <[email protected]>
Date: Tue, 4 Jan 2011 22:59:28 +0100
Subject: [PATCH 1/6] docco fixes

Some typos, articles and similar crap.

Signed-off-by: Jiri Slaby <[email protected]>
---
 doc/man/cgconfig.conf.5 |   12 +++++-------
 doc/man/cgrules.conf.5  |   44 +++++++++++++++++++-------------------------
 2 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/doc/man/cgconfig.conf.5 b/doc/man/cgconfig.conf.5
index b7218b9..fea61ea 100644
--- a/doc/man/cgconfig.conf.5
+++ b/doc/man/cgconfig.conf.5
@@ -5,20 +5,18 @@ cgconfig.conf \- libcgroup configuration file
 .\"***********************************
 .SH DESCRIPTION
 .B "cgconfig.conf"
-is the configuration file used by
+is a configuration file used by
 .B libcgroup
 to define control groups, their parameters and also mount points.
 The file consists of
 .I mount
 and
 .I group
-sections.
-These sections can be in arbitrary order.
-Any line starting with '#' is considered as comment line and is
-ignored.
+sections. These sections can be in arbitrary order. Any line starting with
+'#' is considered as a comment line and is ignored.
 .LP
 .I mount
-section has the form:
+section has this form:
 .RS
 .nf
 .ft B
@@ -53,7 +51,7 @@ automatically on cgconfig service startup if it does not 
exist and
 is deleted on service shutdown.
 .LP
 .I group
-section has the form:
+section has this form:
 .RS
 .nf
 .ft B
diff --git a/doc/man/cgrules.conf.5 b/doc/man/cgrules.conf.5
index 9a8a0a3..676f0cc 100644
--- a/doc/man/cgrules.conf.5
+++ b/doc/man/cgrules.conf.5
@@ -8,12 +8,11 @@ cgrules.conf \- libcgroup configuration file
 .B "cgrules.conf"
 configuration file is used by
 .B libcgroups
-to define the control groups to which the process belongs to.
+to define control groups to which a process belongs.
 
 
-The file the contains list of rules which assign
-to a defined group/user a control group in a subsystem 
-(or control groups in subsystems)
+The file contains a list of rules which assign to a defined group/user a 
control
+group in a subsystem (or control groups in subsystems).
 
 Rules have two formats: 
 
@@ -31,8 +30,8 @@ Where:
 .I user
 can be:
 .nf
-    - an user name
-    - a group name, with @group syntax
+    - a user name
+    - a group name with @group syntax
     - the wildcard '*', for any user or group
     - '%', which is equivalent to "ditto" (useful for 
       multi-line rules where different cgroups need to be 
@@ -69,7 +68,7 @@ can be:
           '\\' can be used to escape '%'
 .fi
 
-First rule which matches the criteria  will be executed.
+First rule which matches the criteria will be executed.
 
 
 Any text starting with '#' is considered as a start of comment line and is
@@ -80,41 +79,36 @@ ignored.
 .nf
 student         devices         /usergroup/students
 .fi
-the processes of user 
-student
-in the subsystem 'device' belong to the control group /usergroup/students.
+Student's processes in the 'devices' subsystem belong to the control
+group /usergroup/students.
 
 .nf
 student:cp       devices         /usergroup/students/cp
 .fi
-the 'cp' command processes of user 
-student
-in the subsystem 'device' belong to the control group /usergroup/students/cp.
+When student executes 'cp' command, the processes in the 'devices' subsystem
+belong to the control group /usergroup/students/cp.
 
 .nf
 @admin           *              admingroup/
 .fi
-the processes which belong to group
-admin
-in all subsystems belongs to the control group /admingroup.
+Processes started by anybody from admin group no matter in what subsystem 
belong
+to the control group admingroup/.
 
 .nf
 peter           cpu             test1/
 %               memory          test2/
 .fi
-First line says Peter's task for cpu controller
-belongs to test1 control group
-second line says put Peter's tasks for memory controller
-belongs to test2/ control group
+The first line says Peter's task for cpu controller belongs to test1 control
+group. The second one says Peter's tasks for memory controller belong to test2/
+control group.
 
 .nf 
 *               *               default/ 
 .fi
-all processes belong in all subsystems
-to the control group default/.  Because there is applied the first task which 
is find -
-it has a sense to have this row at the end of list to put the
-tasks which was not mentioned in the previous rules
-to the default/ control group.
+All processes in any subsystem belong to the control group default/. Since
+the earliest matched rule is applied, it makes sense to have this line
+at the end of the list. It will put a task which was not mentioned in the
+previous rules to default/ control group.
 
 
 
-- 
1.7.3.4

++++++ 0003-scripts-init.d-cgconfig-cleanup.patch ++++++
>From 7bd634ba695c99e768f1b79fed51e6a12ca5a141 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <[email protected]>
Date: Tue, 4 Jan 2011 23:28:28 +0100
Subject: [PATCH 3/6] scripts/init.d: cgconfig, cleanup

* get rid of some unneeded bashisms
* remove unused variables
* define lockfile to be used all over the file
* define restart, to not duplicate code

Signed-off-by: Jiri Slaby <[email protected]>
---
 scripts/init.d/cgconfig.in |   73 +++++++++++++++++--------------------------
 1 files changed, 29 insertions(+), 44 deletions(-)

diff --git a/scripts/init.d/cgconfig.in b/scripts/init.d/cgconfig.in
index 0b3afd2..d9d67d7 100644
--- a/scripts/init.d/cgconfig.in
+++ b/scripts/init.d/cgconfig.in
@@ -32,14 +32,9 @@
 # get correct location of binaries from configure
 prefix=@prefix@;exec_prefix=@exec_prefix@;sbindir=@sbindir@
 CGCONFIGPARSER_BIN=$sbindir/cgconfigparser
-CGROUP_FS=cgroup
 CONFIG_FILE=/etc/cgconfig.conf
-
-# support multiple mount points
-declare -a MOUNTPOINT
-declare -a MOUNTOPTS
-maxindex=0
 servicename=cgconfig
+lockfile=/var/lock/subsys/$servicename
 
 #
 # Source LSB routines
@@ -52,17 +47,13 @@ if [ -e /etc/sysconfig/cgconfig ]; then
         . /etc/sysconfig/cgconfig
 fi
 
-RETVAL=0
-
 create_default_groups() {
-        declare defaultcgroup
+       defaultcgroup=
 
-        if [ -f /etc/cgrules.conf ]
-        then
-            read user ctrl defaultcgroup <<< \
-               `grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf`
-            if [[ -n $defaultcgroup && $defaultcgroup = "*" ]]
-            then
+        if [ -f /etc/cgrules.conf ]; then
+           grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf | \
+                   read user ctrl defaultcgroup
+            if [ -n "$defaultcgroup" -a "$defaultcgroup" = "*" ]; then
                 log_warning_msg "/etc/cgrules.conf incorrect"
                 log_warning_msg "Overriding it"
                 defaultcgroup=
@@ -106,38 +97,33 @@ create_default_groups() {
 
 start() {
         echo -n "Starting cgconfig service: "
-       if [ -f /var/lock/subsys/$servicename ]
-        then
+       if [ -f "$lockfile" ]; then
             log_warning_msg "lock file already exists"
             return 0
         fi
 
-        if [ $? -eq 0 ]
-        then
-                if [ ! -s $CONFIG_FILE ]
-                then
+        if [ $? -eq 0 ]; then
+                if [ ! -s $CONFIG_FILE ]; then
                     log_failure_msg $CONFIG_FILE "is not configured"
                     return 6
                 fi
 
                 $CGCONFIGPARSER_BIN -l $CONFIG_FILE
                 retval=$?
-                if [ $retval -ne 0 ]
-                then
+                if [ $retval -ne 0 ]; then
                     log_failure_msg "Failed to parse " $CONFIG_FILE
                     return 1
                 fi
         fi
 
-        if [ $CREATE_DEFAULT == "yes" ]; then
+        if [ $CREATE_DEFAULT = "yes" ]; then
                 create_default_groups
         fi
 
-        touch /var/lock/subsys/$servicename
+        touch "$lockfile"
         retval=$?
-        if [ $retval -ne 0 ]
-        then
-            log_failure_msg "Failed to touch " /var/lock/subsys/$servicename
+        if [ $retval -ne 0 ]; then
+            log_failure_msg "Failed to touch $lockfile"
             return 1
         fi
         log_success_msg
@@ -147,7 +133,7 @@ start() {
 stop() {
     echo -n "Stopping cgconfig service: "
     cgclear
-    rm -f /var/lock/subsys/$servicename
+    rm -f "$lockfile"
     log_success_msg
     return 0
 }
@@ -174,38 +160,37 @@ common() {
     trap "trapped INT"   INT
 }
 
+restart() {
+       common
+       stop
+       start
+}
+
+RETVAL=0
+
 case $1 in
     'stop')
         common
-        stop;
+        stop
         RETVAL=$?
         ;;
     'start')
         common
-        start;
-        RETVAL=$?
-        ;;
-    'restart')
-        common
-       stop
         start
         RETVAL=$?
         ;;
-    'reload')
-        common
-       stop
-        start
+    'restart'|'reload')
+       restart
         RETVAL=$?
         ;;
     'condrestart')
-        if [ -f /var/lock/subsys/$servicename ] ; then
-            stop
-            start
+        if [ -f "$lockfile" ]; then
+            restart
             RETVAL=$?
         fi
         ;;
     'status')
-        if [ -f /var/lock/subsys/$servicename ] ; then
+        if [ -f "$lockfile" ]; then
             echo "Running"
             exit 0
         else
-- 
1.7.3.4

++++++ 0004-scripts-init.d-little-cleanup-cgred.in.patch ++++++
>From d301c8a82ab1ad28406bc8723c7e5c6350e0b63b Mon Sep 17 00:00:00 2001
From: Jiri Slaby <[email protected]>
Date: Wed, 12 Jan 2011 15:46:37 +0100
Subject: [PATCH 4/6] scripts/init.d: little cleanup cgred.in

Merge most of suse changes into these scripts to lower the maintanance
burden for us:
* define lockfile and use all over the code
* RETVAL should be used only in the big switch
* use quotes in some places

Signed-off-by: Jiri Slaby <[email protected]>
---
 scripts/init.d/cgred.in |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/scripts/init.d/cgred.in b/scripts/init.d/cgred.in
index 0bea9e8..9ff2d9b 100644
--- a/scripts/init.d/cgred.in
+++ b/scripts/init.d/cgred.in
@@ -63,14 +63,13 @@ fi
 # For convenience
 processname=cgrulesengd
 servicename=cgred
+lockfile="/var/lock/subsys/$servicename"
 pidfile=/var/run/cgred.pid
 
-RETVAL=0
-
 start()
 {
        echo -n $"Starting CGroup Rules Engine Daemon: "
-       if [ -f "/var/lock/subsys/$servicename" ] ; then
+       if [ -f "$lockfile" ]; then
                log_failure_msg "$servicename is already running with PID `cat 
${pidfile}`"
                return 0
        fi
@@ -84,12 +83,12 @@ start()
                return 1
        fi
        daemon --check $servicename --pidfile $pidfile $CGRED_BIN $OPTIONS
-       RETVAL=$?
+       retval=$?
        echo
-       if [ $RETVAL -ne 0 ]; then
+       if [ $retval -ne 0 ]; then
                return 7
        fi
-       touch /var/lock/subsys/$servicename
+       touch "$lockfile"
        if [ $? -ne 0 ]; then
                return 1
        fi
@@ -104,17 +103,18 @@ stop()
                log_success_msg
                return 0
        fi
-       killproc -p $pidfile $processname -TERM
-       RETVAL=$?
+       killproc -p $pidfile -TERM "$processname"
+       retval=$?
        echo
-       if [ $RETVAL -ne 0 ] ; then
+       if [ $retval -ne 0 ]; then
                return 1
        fi
-       rm -f /var/lock/subsys/$servicename
-       rm -f $pidfile
+       rm -f "$lockfile" "$pidfile"
        return 0
 }
 
+RETVAL=0
+
 # See how we are called
 case "$1" in
        start)
@@ -132,15 +132,17 @@ case "$1" in
        restart)
                stop
                start
+               RETVAL=$?
                ;;
        condrestart)
-               if [ -f /var/lock/subsys/$servicename ] ; then
+               if [ -f "$lockfile" ]; then
                        stop
                        start
+                       RETVAL=$?
                fi
                ;;
        reload|flash)
-               if [ -f /var/lock/subsys/$servicename ] ; then
+               if [ -f "$lockfile" ]; then
                        echo $"Reloading rules configuration..."
                        kill -s 12 `cat ${pidfile}`
                        RETVAL=$?
-- 
1.7.3.4

++++++ 0005-configure.in-fix-autoconf-error.patch ++++++
>From 31051892a56bcf7a1cdfe140b394dff1191bba67 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <[email protected]>
Date: Wed, 12 Jan 2011 16:47:01 +0100
Subject: [PATCH 5/6] configure.in: fix autoconf error

Autoconf expects an email in AC_INIT, otherwise it screams:
configure.in:18: warning: AC_INIT: not a literal: 
http://sourceforge.net/tracker/?group_id=218421&atid=1043649

Remove the URL, "/" and "&" are not allowed there.

Signed-off-by: Jiri Slaby <[email protected]>
---
 configure.in |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 936f113..0575e79 100644
--- a/configure.in
+++ b/configure.in
@@ -15,8 +15,7 @@
 AC_PREREQ(2.61)
 
 # In following section update all occurences of version, including soname
-AC_INIT([libcgroup], 0.37,
-       [http://sourceforge.net/tracker/?group_id=218421&atid=1043649])
+AC_INIT([libcgroup], 0.37)
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-- 
1.7.3.4

++++++ 0006-scripts-set-executable-the-init-scripts.patch ++++++
>From c32546b155c9c220ea0d67fb2fcb8bf2e63f12e7 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <[email protected]>
Date: Wed, 12 Jan 2011 16:48:06 +0100
Subject: [PATCH 6/6] scripts: set executable the init scripts

When installing the init scripts, mark them as executable so that they
may be used immediately.

Signed-off-by: Jiri Slaby <[email protected]>
---
 scripts/Makefile.am |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index c78272c..dc18140 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -5,6 +5,8 @@ INITSCRIPTDIR=$(DESTDIR)$(sysconfdir)/rc.d/init.d
 install-exec-hook:
        mkdir -p $(INITSCRIPTDIR)
        cp init.d/cgconfig init.d/cgred $(INITSCRIPTDIR)
+       chmod 755 $(INITSCRIPTDIR)/cgred
+       chmod 755 $(INITSCRIPTDIR)/cgconfig
 
 uninstall-hook:
        rm -f $(INITSCRIPTDIR)/cgconfig $(INITSCRIPTDIR)/cgred
-- 
1.7.3.4

++++++ initd_cgconfig.patch ++++++
---
 scripts/init.d/cgconfig.in |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

--- a/scripts/init.d/cgconfig.in
+++ b/scripts/init.d/cgconfig.in
@@ -4,6 +4,8 @@
 #
 # Copyright IBM Corporation. 2008
 #
+# Copyright (c) 2008,2010 Jiri Slaby <[email protected]>
+#
 # Authors:     Balbir Singh <[email protected]>
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2.1 of the GNU Lesser General Public License
@@ -21,10 +23,12 @@
 
 ### BEGIN INIT INFO
 # Provides:             cgconfig
-# Required-Start:
-# Required-Stop:
+# Required-Start:       $local_fs $remote_fs $syslog $time
+# Required-Stop:        $local_fs $remote_fs $syslog $time
 # Should-Start:
 # Should-Stop:
+# Default-Start:        2 3 4 5
+# Default-Stop:         0 1 6
 # Short-Description:    start and stop the WLM configuration
 # Description:          This script allows us to create a default configuration
 ### END INIT INFO
@@ -96,10 +100,9 @@ create_default_groups() {
 }
 
 start() {
-        echo -n "Starting cgconfig service: "
        if [ -f "$lockfile" ]; then
             log_warning_msg "lock file already exists"
-            return 0
+           return 1
         fi
 
         if [ $? -eq 0 ]; then
@@ -126,15 +129,12 @@ start() {
             log_failure_msg "Failed to touch $lockfile"
             return 1
         fi
-        log_success_msg
         return 0
 }
 
 stop() {
-    echo -n "Stopping cgconfig service: "
     cgclear
     rm -f "$lockfile"
-    log_success_msg
     return 0
 }
 
@@ -170,33 +170,41 @@ RETVAL=0
 
 case $1 in
     'stop')
+       echo -n "Stopping service $servicename"
         common
         stop
         RETVAL=$?
+       rc_failed 0
+       rc_status -v
         ;;
     'start')
+       echo -n "Starting service $servicename"
         common
         start
         RETVAL=$?
+       rc_status -v
         ;;
     'restart'|'reload')
        restart
         RETVAL=$?
+       rc_status
         ;;
     'condrestart')
         if [ -f "$lockfile" ]; then
             restart
             RETVAL=$?
         fi
+       rc_status
         ;;
     'status')
+       echo -n "Checking for service $servicename"
         if [ -f "$lockfile" ]; then
-            echo "Running"
-            exit 0
+           rc_failed 0
         else
-            echo "Stopped"
-            exit 3
+           rc_failed 3
+           RETVAL=3
         fi
+       rc_status -v
        ;;
     *)
         usage
++++++ initd_cgred.patch ++++++
---
 scripts/init.d/cgred.in |   64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 26 deletions(-)

--- a/scripts/init.d/cgred.in
+++ b/scripts/init.d/cgred.in
@@ -4,6 +4,8 @@
 #
 # Copyright Red Hat Inc. 2008
 #
+# Copyright (C) 2008,2010 Jiri Slaby <[email protected]>
+#
 # Authors:     Steve Olivieri <[email protected]>
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2.1 of the GNU Lesser General Public License
@@ -23,10 +25,12 @@
 #
 ### BEGIN INIT INFO
 # Provides:            cgrulesengd
-# Required-Start:      $local_fs $syslog $cgconfig
-# Required-Stop:       $local_fs $syslog
+# Required-Start:      $local_fs $remote_fs $syslog cgconfig
+# Required-Stop:       $local_fs $remote_fs $syslog cgconfig
 # Should-Start:                
 # Should-Stop:         
+# Default-Start:       2 3 4 5
+# Default-Stop:                0 1 6
 # Short-Description:   start and stop the cgroups rules engine daemon
 # Description:         CGroup Rules Engine is a tool for automatically using \
 #                      cgroups to classify processes
@@ -39,14 +43,12 @@ CGRED_CONF=/etc/cgrules.conf
 # Sanity checks
 [ -x $CGRED_BIN ] || exit 1
 
-# Source function library & LSB routines
-. /etc/rc.d/init.d/functions
 . /lib/lsb/init-functions
 
 # Read in configuration options.
-if [ -f "/etc/sysconfig/cgred.conf" ] ; then
-       . /etc/sysconfig/cgred.conf
-       OPTIONS="$NODAEMON $LOG"
+if [ -f "/etc/sysconfig/cgred" ] ; then
+       . /etc/sysconfig/cgred
+       OPTIONS="$CGRED_OPTIONS"
        if [ -n "$LOG_FILE" ]; then
                OPTIONS="$OPTIONS --logfile=$LOG_FILE"
        fi
@@ -68,10 +70,15 @@ pidfile=/var/run/cgred.pid
 
 start()
 {
-       echo -n $"Starting CGroup Rules Engine Daemon: "
        if [ -f "$lockfile" ]; then
-               log_failure_msg "$servicename is already running with PID `cat 
${pidfile}`"
-               return 0
+               pidofproc -k -p $pidfile $CGRED_BIN
+               if [ $? -eq 7 ]; then
+                       log_warning_msg "Removing stale lock file $lockfile"
+                       rm -f "$lockfile" "$pidfile"
+               else
+                       log_failure_msg "$servicename is already running with 
PID `cat ${pidfile}`"
+                       return 1
+               fi
        fi
        if [ ! -s $CGRED_CONF ]; then
                log_failure_msg "not configured"
@@ -82,9 +89,8 @@ start()
                log_failure_msg $"Cannot find cgroups, is cgconfig service 
running?"
                return 1
        fi
-       daemon --check $servicename --pidfile $pidfile $CGRED_BIN $OPTIONS
+       start_daemon -p $pidfile $CGRED_BIN $OPTIONS
        retval=$?
-       echo
        if [ $retval -ne 0 ]; then
                return 7
        fi
@@ -92,20 +98,18 @@ start()
        if [ $? -ne 0 ]; then
                return 1
        fi
-       echo "`pidof $processname`" > $pidfile
+       pidofproc $CGRED_BIN > $pidfile
        return 0
 }
 
 stop()
 {
-       echo -n $"Stopping CGroup Rules Engine Daemon..."
        if [ ! -f $pidfile ]; then
                log_success_msg
                return 0
        fi
-       killproc -p $pidfile -TERM "$processname"
+       killproc -p $pidfile -TERM $processname
        retval=$?
-       echo
        if [ $retval -ne 0 ]; then
                return 1
        fi
@@ -118,21 +122,32 @@ RETVAL=0
 # See how we are called
 case "$1" in
        start)
+               echo -n "Starting CGroup Rules Engine Daemon"
                start
                RETVAL=$?
+               rc_status -v
                ;;
        stop)
+               echo -n "Stopping CGroup Rules Engine Daemon"
                stop
                RETVAL=$?
+               rc_status -v
                ;;
        status)
-               status -p $pidfile $servicename
+               echo -n "Checking for CGroup Rules Engine Daemon"
+               checkproc -k -p $pidfile $CGRED_BIN
                RETVAL=$?
+               if [ $RETVAL -eq 7 ] ; then
+                       rc_failed 3
+                       RETVAL=3
+               fi
+               rc_status -v
                ;;
        restart)
                stop
                start
                RETVAL=$?
+               rc_status
                ;;
        condrestart)
                if [ -f "$lockfile" ]; then
@@ -140,20 +155,17 @@ case "$1" in
                        start
                        RETVAL=$?
                fi
+               rc_status
                ;;
        reload|flash)
                if [ -f "$lockfile" ]; then
-                       echo $"Reloading rules configuration..."
-                       kill -s 12 `cat ${pidfile}`
-                       RETVAL=$?
-                       if [ $RETVAL -eq 0 ] ; then
-                               log_success_msg
-                       else
-                               log_failure_msg
-                       fi
+                       echo -n "Reloading rules configuration..."
+                       killproc -SIGUSR2 -p $pidfile $CGRED_BIN
                else
-                       log_failure_msg "$servicename is not running."
+                       echo "$servicename is not running."
+                       rc_failed 7
                fi
+               rc_status -v
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
++++++ sysconfig.cgred ++++++
--- /var/tmp/diff_new_pack.tSuuKF/_old  2011-02-25 11:48:33.000000000 +0100
+++ /var/tmp/diff_new_pack.tSuuKF/_new  2011-02-25 11:48:33.000000000 +0100
@@ -11,15 +11,21 @@
 ## Type:       string
 ## Default:    ""
 #
-# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
 # Use --nodaemon to disable daemon mode.
+# Use --nolog to disable logging.
 #
-NODAEMON=""
+CGRED_OPTIONS=""
 
 ## Type:       string
 ## Default:    ""
 #
-# Uncomment the second line to disable logging for CGroup Rules Engine
-# Use --nolog to disable logging.
+# Set owner (user) of cgrulesengd socket.
+#
+SOCKET_USER=""
+
+## Type:       string
+## Default:    ""
+#
+# Set owner (group) of cgrulesengd socket.
 #
-NOLOG=""
+SOCKET_GROUP=""


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to