Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#26  2013-07-04 15:56:48

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

Kod:

root:/# ls  /cgroup/memory/users/opera/

Masz tam kilka plików *stat i *usage*  które służą do wyświetlania różnych szczegółowych informacji.

Przykładowo:

Kod:

cat  /cgroup/memory/users/firefox/memory.stat
cache 116998144
rss 685170688
mapped_file 36450304
swap 0
pgpgin 1104680
pgpgout 908838
pgfault 1249896
pgmajfault 410
inactive_anon 378224640
active_anon 307650560
inactive_file 60002304
active_file 56291328
unevictable 0
hierarchical_memory_limit 1073741824
hierarchical_memsw_limit 1073741824
total_cache 116998144
total_rss 685170688
total_mapped_file 36450304
total_swap 0
total_pgpgin 1104680
total_pgpgout 908838
total_pgfault 1249896
total_pgmajfault 410
total_inactive_anon 378224640
total_active_anon 307650560
total_inactive_file 60002304
total_active_file 56291328
total_unevictable 0

Wystarczy, czy czegoś brakuje?

Sprawdzanie pamięci dla procesu?
W kilobajtach może być? :D

Kod:

cat  /proc/`pidof pidgin`/status | grep Vm
VmPeak:      754760 kB
VmSize:      754756 kB
VmLck:           0 kB
VmPin:           0 kB
VmHWM:       96888 kB
VmRSS:       96868 kB
VmData:       47248 kB
VmStk:         212 kB
VmExe:        1072 kB
VmLib:      131512 kB
VmPTE:        1208 kB
VmSwap:           0 kB

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2013-07-04 16:07:23)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#27  2013-07-04 16:12:37

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Domyślam się, że swap to jest od zajętości miejsca w swapie ale u mnie tego nie ma. xD

Kod:

# cat  /cgroup/memory/users/opera/memory.stat 
cache 970752
rss 207077376
mapped_file 692224
pgpgin 772980
pgpgout 722187
pgfault 929071
pgmajfault 35475
inactive_anon 104161280
active_anon 103378944
inactive_file 430080
active_file 147456
unevictable 0
hierarchical_memory_limit 209715200
total_cache 970752
total_rss 207077376
total_mapped_file 692224
total_pgpgin 772980
total_pgpgout 722187
total_pgfault 929071
total_pgmajfault 35475
total_inactive_anon 104161280
total_active_anon 103378944
total_inactive_file 430080
total_active_file 147456
total_unevictable 0

W tym drugim chyba jest:

Kod:

# cat  /proc/`pidof opera`/status | grep Vm
VmPeak:      868976 kB
VmSize:      778752 kB
VmLck:           0 kB
VmPin:           0 kB
VmHWM:      257576 kB
VmRSS:      256416 kB
VmData:      646468 kB
VmStk:        1052 kB
VmExe:       22384 kB
VmLib:       86340 kB
VmPTE:        1472 kB
VmSwap:      371008 kB

Ostatnio edytowany przez morfik (2013-07-04 16:13:46)

Offline

 

#28  2013-07-04 20:37:05

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

Kod:

cat /cgroup/memory/users/opera/memory.stat 
cache 77684736
rss 194715648
mapped_file 13590528
swap 0
pgpgin 87339
pgpgout 20835
pgfault 104268
pgmajfault 356
inactive_anon 11550720
active_anon 183164928
inactive_file 71905280
active_file 5779456
unevictable 0
hierarchical_memory_limit 536870912
hierarchical_memsw_limit 536870912
total_cache 77684736
total_rss 194715648
total_mapped_file 13590528
total_swap 0
total_pgpgin 87339
total_pgpgout 20835
total_pgfault 104268
total_pgmajfault 356
total_inactive_anon 11550720
total_active_anon 183164928
total_inactive_file 71905280
total_active_file 5779456
total_unevictable 0

Kod:

grep opera `which cgstart`
mkdir -p $CGDIR/cpu/users/opera
echo '1'> $CGDIR/cpu/users/opera/cgroup.clone_children
echo '300' > $CGDIR/cpu/users/opera/cpu.shares
mkdir -p $CGDIR/cpuacct/users/opera
mkdir -p $CGDIR/cpuset/users/opera
mkdir -p $CGDIR/memory/users/opera
echo '1'> $CGDIR/memory/users/opera/cgroup.clone_children
echo '512m' >   $CGDIR/memory/users/opera/memory.soft_limit_in_bytes
echo '32m' > $CGDIR/memory/users/opera/memory.kmem.tcp.limit_in_bytes
echo '512m' >   $CGDIR/memory/users/opera/memory.limit_in_bytes
echo '512m' >   $CGDIR/memory/users/opera/memory.memsw.limit_in_bytes
echo '1' >   $CGDIR/memory/users/opera/memory.oom_control 
mkdir -p $CGDIR/net_cls/users/opera
echo '1' > $CGDIR/net_cls/users/opera/cgroup.clone_children
echo '0x1004' > $CGDIR/net_cls/users/opera/net_cls.classid

Kod:

cat  /proc/`pidof opera`/cgroup
13:hugetlb:/
12:net_prio:/
11:perf_event:/
10:blkio:/
9:net_cls:/users/opera
8:freezer:/
7:devices:/
6:memory:/users/opera
5:cpuacct:/
4:cpu:/users/opera
3:debug:/
2:cpuset:/
1:name=openrc:/xdm

SOA#1

W rolach głównych udział wzięli:
http://jacekalex.sh.dug.net.pl/cgstartnew
http://jacekalex.sh.dug.net.pl/cgrules.conf


Poza tym, jest taka piosenka:
"Co Ci przypomina, co Ci przypomina, widok znajomy ten"

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2013-07-04 20:53:49)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#29  2013-07-04 22:16:57

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Ja chyba zrobiłem z tym porządek w końcu.

2 skrypty startowe:

/etc/init.d/cgconfig

Kod:

#!/bin/bash
#
# Start/Stop the workload manager
#
# Copyright IBM Corporation. 2008
#
# Authors:     Balbir Singh <balbir@linux.vnet.ibm.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
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# cgconfig Control Groups Configuration Startup
# chkconfig: - 5 95
# description: This script runs the cgconfigparser utility to parse and setup
#              the control group filesystem. It uses /etc/cgconfig.conf
#              and parses the configuration specified in there.

### BEGIN INIT INFO
# Provides:             cgconfig
# Required-Start:        $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         ypbind
# Should-Stop:          ypbind
# Default-Start:           2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Create and setup control group filesystem(s)
# Description:          Create and setup control group filesystem(s)
### END INIT INFO

# get correct location of binaries from configure
prefix=/usr;exec_prefix=${prefix};sbindir=${exec_prefix}/sbin
CGCONFIGPARSER_BIN=$sbindir/cgconfigparser
CONFIG_FILE=/etc/cgconfig.conf
servicename=cgconfig
lockfile=/var/lock/subsys/$servicename

#
# Source LSB routines
#
. /lib/lsb/init-functions

# read the config
CREATE_DEFAULT=yes
if [ -e /etc/default/cgconfig ]; then
        . /etc/default/cgconfig
fi

create_default_groups() {
    defaultcgroup=

        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=
            fi
        fi

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

        #
        # Find all mounted subsystems and create comma-separated list
        # of controllers.
        #
        controllers=`lssubsys 2>/dev/null | tr '\n' ',' | sed s/.$//`

        #
        # Create the default group, ignore errors when the default group
        # already exists.
        #
        cgcreate -f 664 -d 775 -g $controllers:$defaultcgroup 2>/dev/null

        #
        # special rule for cpusets
        #
        if echo $controllers | grep -q -w cpuset; then
                cpus=`cgget -nv -r cpuset.cpus /`
                cgset -r cpuset.cpus=$cpus $defaultcgroup
                mems=`cgget -nv -r cpuset.mems /`
                cgset -r cpuset.mems=$mems $defaultcgroup
        fi

        #
        # Classify everything to default cgroup. Ignore errors, some processes
        # may exit after ps is run and before cgclassify moves them.
        #
        cgclassify -g $controllers:$defaultcgroup `ps --no-headers -eL o tid` \
                 2>/dev/null || :
}

start() {
    if [ ! -d "/var/lock/subsys" ]; then 
        mkdir /var/lock/subsys 
    fi
        echo -n "Starting cgconfig service: "
    if [ -f "$lockfile" ]; then
            log_warning_msg "lock file already exists"
            return 0
        fi

        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
                    log_failure_msg "Failed to parse " $CONFIG_FILE
                    return 1
                fi
        fi

        if [ $CREATE_DEFAULT = "yes" ]; then
                create_default_groups
        fi

        touch "$lockfile"
        retval=$?
        if [ $retval -ne 0 ]; then
            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
}

trapped() {
    #
    # Do nothing
    #
    true
}

usage() {
    echo "$0 <start|stop|restart|condrestart|status>"
    exit 2
}

common() {
    #
    # main script work done here
    #
    trap "trapped ABRT" ABRT
    trap "trapped QUIT" QUIT
    trap "trapped TERM" TERM
    trap "trapped INT"   INT
}

restart() {
    common
    stop
    start
}

RETVAL=0

case $1 in
    'stop')
        common
        stop
        RETVAL=$?
        ;;
    'start')
        common
        start
        RETVAL=$?
        ;;
    'restart'|'reload')
    restart
        RETVAL=$?
        ;;
    'condrestart')
        if [ -f "$lockfile" ]; then
            restart
            RETVAL=$?
        fi
        ;;
    'status')
        if [ -f "$lockfile" ]; then
            echo "Running"
            exit 0
        else
            echo "Stopped"
            exit 3
        fi
    ;;
    *)
        usage
        ;;
esac

exit $RETVAL

oraz /etc/init.d/cgrulesengd

Kod:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          cgrulesengd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: CGroups rules engine daemon
# Description:       CGroup Rules Engine is a tool for automatically using
#                     cgroups to classify processes
### END INIT INFO

# Author: Morfik
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

# Do NOT "set -e"

# Read configuration variable file if it is present
if [ -f "/etc/default/cgrulesengd" ] ; then
    . /etc/default/cgrulesengd
    OPTIONS="$NODAEMON $LOG"
    if [ -n "$LOG_FILE" ]; then
        OPTIONS="$OPTIONS --logfile=$LOG_FILE"
    fi
    if [ -n "$SOCKET_USER" ]; then
        OPTIONS="$OPTIONS -u $SOCKET_USER"
    fi
    if [ -n "$SOCKET_GROUP" ]; then
        OPTIONS="$OPTIONS -g $SOCKET_GROUP"
    fi
else
    OPTIONS=""
fi

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="CGroups rules engine daemon"
NAME=cgrulesengd
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="$OPTIONS"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
        $DAEMON_ARGS \
        || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=TERM/2/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently.  A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --retry=0/2/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
    return 0
}
VERBOSE="yes"

case "$1" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_start
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  status)
    status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
    ;;
  #reload|force-reload)
    #
    # If do_reload() is not implemented then leave this commented out
    # and leave 'force-reload' as an alias for 'restart'.
    #
    #log_daemon_msg "Reloading $DESC" "$NAME"
    #do_reload
    #log_end_msg $?
    #;;
  restart|force-reload)
    #
    # If the "reload" option is implemented then remove the
    # 'force-reload' alias
    #
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
        do_start
        case "$?" in
            0) log_end_msg 0 ;;
            1) log_end_msg 1 ;; # Old process is still running
            *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
      *)
        # Failed to stop
        log_end_msg 1
        ;;
    esac
    ;;
  *)
    #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
    exit 3
    ;;
esac

:

Dwa pliki konfiguracyjne w /etc/default/ :

/etc/default/cgconfig :

Kod:

# Service cgconfig can create a default group in all mounted hierarchies and
# move all processes there on boot. If no default rule is specified in
# /etc/cgrules.conf, the default group is named '/sysdefault'.
# This automatically created group(s) can be useful e.g. when using 'cpu'
# controller to limit cpu.shares of this default group and allowing some more
# important group take most of the CPU.
#
# By default, create these groups:
#CREATE_DEFAULT=yes

# Uncomment following line to disable creation of the default group on startup:
CREATE_DEFAULT=no

/etc/default/cgrulesengd :

Kod:

# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
# 
# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
# the only valid ones.  Defining anything else in this file will cause the
# CGroup Rules Engine program to fail.  So, don't do it.

# The pathname to the configuration file for CGroup Rules Engine
CONFIG_FILE="/etc/cgrules.conf"

# Uncomment the following line to log to specified file instead of syslog
LOG_FILE="/var/log/cgrulesengd.log"

# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
NODAEMON=""
#NODAEMON="--nodaemon"

# Set owner of cgred socket. 'cgexec' tool should have write access there
# (either using suid and/or sgid permissions or Linux capabilities).
#SOCKET_USER=""
#SOCKET_GROUP="cgred"

# Uncomment the second line to disable logging for CGroup Rules Engine
# Uncomment the third line to enable more verbose logging.
#LOG=""
#LOG="--nolog"
LOG="-v"

Nie umiem za bardzo przepisać tego pierwszego skryptu ale działa w takiej formie jak jest.

Do tego pliki:

/etc/cgconfig.conf

Kod:

#
#  Copyright IBM Corporation. 2007
#
#  Authors:    Balbir Singh <balbir@linux.vnet.ibm.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
#  as published by the Free Software Foundation.
#
#  This program is distributed in the hope that it would be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#

mount {
    cpuset  = /cgroup/cpuset;
    cpu     = /cgroup/cpu;
    cpuacct = /cgroup/cpuacct;
    memory  = /cgroup/memory;
    devices = /cgroup/devices;
    freezer = /cgroup/freezer;
    net_cls = /cgroup/net_cls;
    blkio   = /cgroup/blkio;
}


group users/opera {
    perm {
        task {
            uid = root;
            gid = root;
        }
        admin {
            uid = root;
            gid = root;
        }
    }
    cpu {
        cpu.shares = "512";
    }
    memory {
        memory.limit_in_bytes = 400M;
    }
}

/etc/cgrules.conf

Kod:

*:opera*                                   cpu,memory,net_cls    users/opera/
*:opera                                    cpu,memory,net_cls   users/opera/

Test:

Kod:

# /etc/init.d/cgrulesengd  stop
[ ok ] Stopping CGroups rules engine daemon: cgrulesengd.
# /etc/init.d/cgconfig stop
[ ok ing cgconfig service: .
# /etc/init.d/cgconfig start
[ ok ing cgconfig service: .
# /etc/init.d/cgrulesengd  start
[ ok ] Starting CGroups rules engine daemon: cgrulesengd.
# ps -eo "%mem pid user args"  | grep cgrul
0.1 17890 root     /usr/sbin/cgrulesengd -v --logfile=/var/log/cgrulesengd.log
# cat  /proc/`pidof opera`/cgroup
32:blkio:/
31:net_cls:/
30:freezer:/
29:devices:/
28:memory:/users/opera
27:cpuacct:/
26:cpu:/users/opera
25:cpuset:/

Teraz tylko dodawać regułki. xD i przydałoby się poprawić ten 1 skrypt.

Offline

 

#30  2013-07-04 22:32:20

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

Jak ja chciałem ustawić wsio w cgconfig, to przez pół dnia miałem same błędy.

W końcu się wkurzyłem, zostawiłem czysty cgconfig.conf (wtedy cgconfig i cgred wstają  prawidłowo), zrobiłem sobie skrypta, żeby limitował firefoxa, zadziałało, to kopiowałem i zmieniałem nazwy programów, aż powstał cgstart, i dalej rośnie. :D

Pozostało tylko w cgrules.conf ustawić, żeby pakował programy, gdzie trzeba (zabawa aliansami i skryptami przy większej liczbie programów nie jest zbyt wygodna), i gotowe.

W skrypcie każda zmiana i poprawka trwa maksimum 5 minut, na pieprzenie z konfiguracją cgconfig mi szkoda czasu i nerwów.

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2013-07-04 23:04:17)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#31  2013-07-04 22:38:55

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

A jeszcze taki problem jest, bo czasem przy starcie systemu, cgrulesengd startuje przed cgconfig, -- to mam dopisać w skrypcie cgrulesengd?

Kod:

# Required-Start:    $remote_fs $syslog $cgconfig
# Required-Stop:     $remote_fs $syslog $cgconfig

Offline

 

#32  2013-07-04 23:13:28

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

Skąd mam wiedzieć?

Ja ustawiłem cgstart przed cgconfig i cgred w /etc/rc.conf, ale w OpenRC, a nie systemd.
Jak używasz systemd, to już twoja małpa i twój cyrk, kombinuj.

Ten brak skryptów startowych u Ciebie, to preludium wielkiego pomysłu RedHata?  i Lennarta Petteringa, żeby systemd, udev i  cgroup stanowiły jedną całość, i wszystko razem działało, jak NM czy PA. :D

Linus ich spłukał z tymi pomysłami, jajo już może ładować firmware samo, bez udeva, Developerzy Gentoo też pomysł kolegów spłukali, zrobili eudeva - fork udeva, a Debian i Arch dziwnym trafem idą za tymi pomysłami, jak prosiaki do rzeźni.

Cel jest taki: linux = systemd, bez systemd nie ma Linuxa.
Identyczna polityka jest z NM i PA, choć oczywiście te programy nie mają takiego znaczenia, jak systemd,
i łatwiej je zastąpić w systemie.

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2013-07-04 23:24:49)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#33  2013-07-05 01:26:10

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

No ale ja nie mam systemd. :] i chodzi o to by te skrypty się ładowały w odpowiedniej kolejności, a nie raz się jeden załaduje pierwszy, a innym razem drugi.

Offline

 

#34  2013-07-05 10:50:26

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Chyba wiem już jak to zrobić. Teoretycznie powinno się to ustawić za pomocą:

Kod:

update-rc.d cgconfig defaults 20
update-rc.d cgrulesengd defaults 21

Ale mi to i tak ustawia cały czas wszystko na 21. :] Ale można dodać do skryptu cgrulesengd :

Kod:

# Should-Start:      cgconfig
# Should-Stop:       cgconfig

I to powinno wystartować cgconfig przed cgrulesengd. Zresetowałem maszynę 3x i chyba działa. xD

Offline

 

#35  2013-07-05 11:09:07

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

A nie lepiej z tych dwóch skryptów zrobić jednego?
Przecież każdy ma kilka linijek, i jak mają wstawać w odpowiedniej kolejności, to w czym problem?
I tak musiałeś rzeźbić te skrypty, bo w Debianie nie dowieźli. :D

Ostatnio edytowany przez Jacekalex (2013-07-05 11:11:53)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#36  2013-07-05 11:18:39

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Nie jestem dobry w pisaniu skryptów i za bardzo nie przerobie tego skryptu od cgconfig, ten cgrulesengd się łatwo napisało i w sumie stworzenie go wymagało tylko kopii pliku szkieletowego, uzupełniając przy tym odpowiednie wartości. xD

Offline

 

#37  2013-07-05 11:34:26

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: [SOLVED] Cgroup

Skopiowanie kilku linijek?

Start z jednego doklejasz do start z drugiego, tak samo ustawiasz zmienne, stop, restart, itp.
Więcej tu kopiowania i wklejania do nowych linii, niż prawdziwego kodzenia.
Jedna poważna sprawa, to zmienić w jednym skrypcie nazwy zmiennych, żeby się nie dublowały, jeśli w obu się powtarzają  z różnymi wartościami.

Wystarczy podstawowa znajomość basha.

Ostatnio edytowany przez Jacekalex (2013-07-05 11:37:07)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#38  2013-07-05 11:44:10

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Gdyby to były skrypty z debiana to jasne xD ale rzuć okiem na nie. Ja próbowałem przepisać ten domyślny używając pliku szkieletowego ale po ciągłych błędach dałem se siana i zostawiłem taki jak jest.

Offline

 

#39  2013-07-05 18:39:24

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: [SOLVED] Cgroup

Kod:

# Should-Start:      cgconfig
# Should-Stop:       cgconfig

To nie działa. Może za pomocą tego poniżej się uda:

Kod:

root:~#  update-rc.d -f cgrulesengd  remove
update-rc.d: using dependency based boot sequencing
root:~#  update-rc.d -f cgconfig remove
update-rc.d: using dependency based boot sequencing
root:~# update-rc.d cgrulesengd start 30 2 3 4 5 . stop 70 0 1 6 .
update-rc.d: using dependency based boot sequencing
root:~# update-rc.d cgconfig start 29 2 3 4 5 . stop 71 0 1 6 .
update-rc.d: using dependency based boot sequencing
root:~# cd /etc/rc2.d/
root:/etc/rc2.d# ls -al | grep cg
lrwxrwxrwx   1 root root   18 Jul  5 18:32 S21cgconfig -> ../init.d/cgconfig*
lrwxrwxrwx   1 root root   21 Jul  5 18:31 S22cgrulesengd -> ../init.d/cgrulesengd*

Choć to trochę zastanawiające, że dałem numery 29 i 30 a dostałem 21 i 22 :] W każdym razie z tego co piszą w man, powinno działać. Się zobaczy. xD

EDIT:

Przy okazji trafiłem na programik: bum — teraz życie stało się o wiele prostsze. xD

EDIT:

Ok, wszystko jest tak jak być powinno.

Ostatnio edytowany przez morfik (2013-07-06 13:07:36)

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
To nie jest tylko forum, to nasza mała ojczyzna ;-)