[arch-projects] [INITSCRIPTS][PATCH 6/6] Introduce cgroups

Sébastien Luttringer seblu at seblu.net
Tue Jun 12 07:16:09 EDT 2012


On Tue, Jun 12, 2012 at 12:01 AM, Dave Reisner <d at falconindy.com> wrote:
> On Mon, Jun 11, 2012 at 11:10:40PM +0200, Sébastien Luttringer wrote:
> So what do people who compile their own kernels without cgroups do?
With this patch... swtich from century and use cgroup :p

I can rework it to support kernel with and without cgroup (with both
hierarchies).
Just let me know if you see a show stopper.

>
> No need for a while loop here just to trim a string...
>
>  name=${name##+(!|@|-)}
Thank you! That 's what I was looking for! Your bash knowledge
impresses me day by day.

>
>> +                     *) break;;
>> +             esac
>> +     done
>> +     echo $name
>
> Quote, please.
>
I doesn't see the benefits of quoting here.

$ f() { a="toto toto" ; echo $a ; }
$ g() { a="titi titi"; echo "$a"; }
$ for i in $(f); do echo $i; done
toto
toto
$ for i in $(g); do echo $i; done
titi
titi


>> +                     stat_bkgd "${2^} $name"
>
> This is the only place you sentence case a daemon name in the output.
> Intentional?

Yes we are starting daemon in background, so output formating from
script is removed.
Currently we output "Starting $name..."  To keep it generic with
others kind of call (restart, foo, bar) i only capitalize the first
letter.
Output become "Start $name" on startup.

>
>> +                     exec_daemon /etc/rc.d/"$name" "$2" >/dev/null &
>> +             else
>> +                     exec_daemon /etc/rc.d/"$name" "$2"
>> +             fi
>> +     )
>> +     # stop action unregister and cleanup
>> +     if [[ $2 == stop ]]; then
>> +             kill_daemon "$1"
>
> So that's it? We just call kill daemon here and don't even honor the
> script's own stop function anymore?

Stop function is honored by "exec_daemon stop" in previous lines.

> OCD: Is it really too much to ask to write this as a proper if/then?
sure.

> After only 1/4 of a second you send the death touch onto all tasks? Go
> take a look at a service like squid or mysql that can survive at _least_
> 5-10s after receiving a TERM. What about services that don't respond to
> a TERM, but would exit on a HUP? They're going to be invariably death
> touched. This is way too simple of a heuristic to be healthy.

Remember that "stop" script have been called before and have handled
daemon shutdown correctly.
If this function have process to kill, it's garbage collecting.
I take this value from kill_all_wait() function.

>
>> +     printf "e.g: ${C_MAIN}rc.d ${1:-start} ${0##*/}${C_CLEAR}\n" >&2
>
> Magic help messages which change text? Can't we just generalize it?
I don't understand what you mean.

Thanks for your review i will include your suggestions and post a new
patch asap.

-- 
Sébastien "Seblu" Luttringer
www.seblu.net


More information about the arch-projects mailing list