Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
libcgroup
initd_cgred.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File initd_cgred.patch of Package libcgroup
--- scripts/init.d/cgred.in | 64 ++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 26 deletions(-) Index: libcgroup-0.41.rc1/scripts/init.d/cgred.in =================================================================== --- libcgroup-0.41.rc1.orig/scripts/init.d/cgred.in +++ libcgroup-0.41.rc1/scripts/init.d/cgred.in @@ -4,6 +4,8 @@ # # Copyright Red Hat Inc. 2008 # +# Copyright (C) 2008,2010 Jiri Slaby <jslaby@suse.cz> +# # Authors: Steve Olivieri <sjo@redhat.com> # 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 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 @@ -63,15 +65,20 @@ fi # For convenience processname=cgrulesengd servicename=cgred -lockfile="/var/lock/subsys/$servicename" +lockfile="/run/$servicename" 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 num=`grep "cgroup" /proc/mounts | awk '$3=="cgroup"' | wc -l` if [ $num -eq 0 ]; then @@ -79,9 +86,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 @@ -89,20 +95,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" retval=$? - echo if [ $retval -ne 0 ]; then return 1 fi @@ -115,21 +119,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 @@ -137,20 +152,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}"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor