Commit 8a80c9f2 authored by Seblu's avatar Seblu
Browse files

up


git-svn-id: https://seblu.net/s/archpkg@263 02741741-5192-46b8-8916-7152b19231d9
parent e580d7a9
Loading
Loading
Loading
Loading
+15 −33
Original line number Diff line number Diff line
@@ -3,21 +3,21 @@
. /etc/rc.conf
. /etc/rc.d/functions

CREATE_DEFAULT=yes
. /etc/conf.d/cgconfig

# From cgconfig init.d script
create_default_groups() {
  declare defaultcgroup
  local defaultcgroup

  if [ -f /etc/cgrules.conf ]; then
    grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf | \
      read user ctrl defaultcgroup
    if [ -n $defaultcgroup -a $defaultcgroup = "*" ]; then
  if [[ -f /etc/cgrules.conf ]]; then
    grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf | read user ctrl defaultcgroup
    if [[ -n "$defaultcgroup" && "$defaultcgroup" = "*" ]]; then
      defaultcgroup=
    fi
  fi

  if [ -z $defaultcgroup ]; then
  if [[ -z $defaultcgroup ]]; then
    defaultcgroup=sysdefault/
  fi

@@ -25,7 +25,7 @@ create_default_groups() {
  # Find all mounted subsystems and create comma-separated list
  # of controllers.
  #
  controllers=$(lssubsys 2>/dev/null | tr '\n' ',' | sed s/.$//)
  controllers=$(lssubsys 2>/dev/null | tr '\n' ',' | sed 's/.$//')

  #
  # Create the default group, ignore errors when the default group
@@ -55,43 +55,25 @@ create_default_groups() {
  # Classify everything to default cgroup. Ignore errors, some processes
  # may exit after ps is run and before cgclassify moves them.
  #
  classify_all -g $controllers:$defaultcgroup || :
}

classify_all() {
  cgclassify "$@" $(ps --no-headers -eL o tid) 2>/dev/null
  cgclassify -g $controllers:$defaultcgroup $(ps --no-headers -eL o tid) 2>/dev/null || :
}

case "$1" in
  start)
    stat_busy "Starting CGroups configuration"
    cgconfigparser -l /etc/cgconfig.conf
    if [ $? -gt 0 ]; then
      stat_fail
    else
      if [ $CREATE_DEFAULT == "yes" ]; then
        create_default_groups
      fi
      if [ $CLASSIFY == "yes" ]; then
        classify_all
      fi
      add_daemon cgconfig
    stat_busy 'Starting CGroups configuration'
    if cgconfigparser -l /etc/cgconfig.conf; then
      [[ "$CREATE_DEFAULT" == yes ]] && create_default_groups
      add_daemon ${0##*/}
      stat_done
    else
      stat_fail
    fi
    ;;
  stop)
    stat_busy "Clearing CGroups configuration"
    cgclear
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon cgconfig
      stat_done
    fi
    status 'Clearing CGroups configuration' cgclear && rm_daemon ${0##*/}
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ case "$1" in
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)