-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Les mando este mail de la lista de uruguay en la que hablan sobre un script para
arrancar los
servicios de Debian en paralelo y ganar un poco en velocidad.
Peguenle una mirada, yo lo prove en mi Debian Woody en el 486 : )) y gane unos 10 seg.
Es para curiosear pero... en estos d�a de vacas flacas vamos a tener que pensar
nuevamente en la
eficiencia : ) las memorias y los micros estan caros : )
- ---------- Forwarded Message ----------
Subject: [uylug-linux]Debian: arrancandolo mas =?iso-8859-1?Q?r=E1pido=2E?=
Date: Sat, 08 Jun 2002 18:41:10 -0300
From: Luis Baldo <[EMAIL PROTECTED]>
To: UYLUG Linux <[EMAIL PROTECTED]>, SET <[EMAIL PROTECTED]>, MonoDR
<[EMAIL PROTECTED]>
Hola.
Hace tiempo que me vengo preguntando si el sistema arrancar�a mas
r�pido si ejecutara procesos en paralelo... pero reci�n hoy se me di�
por probarlo.
El resultado: si, los arranca mas r�pido :).
Es una modificaci�n media chota al /etc/init.d/rc original de Debian.
Antes demoraba 35 segundos en obtener un login, ahora 30.
Si vale la pena o no lo ver� cada uno, probando el script en su
m�quina. Talvez para algunos no haga mucha diferencia y para otros halla
un incremento mayor de la diferencia. Depende de que si un servicio
espera demasiado por una cosa o son mas bien todos ligeros de arrancar.
Por otro lado, los mensajes terminan mezclandose todos y no se entiende
un comino. Para solucionar eso habr�a que modificar los scripts en
/etc/init.d para que no usen en ning�n lado el "echo -n" sino que usen
siempre echo normales.
�sto lo prob� en un Debian Sid/Woody tanto con bash como con ash,
supongo que no deber�a dar problemas con Potato tampoco.
No me responsabilizo por ning�n da�o que pueda causar.
Para probarlo hay que sustituir el /etc/init.d/rc por �ste archivo que
est� adjunto al mensaje.
Lo hice en ingl�s porque cap�s que se lo doy al autor para que lo
considere, pero conociendo a la gente de Debian no se si me voy a tomar
la molestia... no creo que les guste tener que cambiar todos los scripts
en /etc/init.d y adem�s me van a salir con que "�sto no es normal" o
"�sto no es lo estandard" o que "no vale la pena por ganar unos pocos
segundos", etc.
Bueno, que lo disfruten y si alguien lo prueba que me cuente que tal le
fu� y si not� alguna mejora de performance y adem�s que piensan al
respecto de �ste sistema, etc.
Saludos!
- --
- -------------------------------------------------------
#!/bin/sh
#
# rc This file is responsible for starting/stopping
# services when the runlevel changes.
#
# Optimization feature:
# A startup script is _not_ run when the service was
# running in the previous runlevel and it wasn't stopped
# in the runlevel transition (most Debian services don't
# have K?? links in rc{1,2,3,4,5} )
#
# Author: Miquel van Smoorenburg <[EMAIL PROTECTED]>
# Bruce Perens <[EMAIL PROTECTED]>
#
# Version: @(#)rc 2.78 07-Nov-1999 [EMAIL PROTECTED]
#
# Unofficial modified version by Iv�n Baldo <[EMAIL PROTECTED]>.
# Date: 8 jun 2002 17:02 -0300.
#
# Changes: start/stop processes simultaneously in the background, this
# speeds up startup from 35 seconds (original version) to 30 seconds
# (this version) on my machine, though doesn't impacts on shutdown time
# which it is 13 seconds with either method.
#
# Known problems: script messages are a mess and we can't help that
# without modifying /etc/init.d scripts. No, using temporary files or
# other means that delay the output of messages are unsatisfactory
# because this could complicate debugging of problems, the output of
# the messages *must* be in realtime.
# Un-comment the following for debugging.
# debug=echo
#
# Start script or program.
#
startup() {
case "$1" in
*.sh)
$debug sh "$@" &
;;
*)
$debug "$@" &
;;
esac
# Un-comment the following for sequential execution (instead
# of parallel).
# wait
}
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP
# Set onlcr to avoid staircase effect.
stty onlcr 0>&1
# Now find out what the current and what the previous runlevel are.
runlevel=$RUNLEVEL
# Get first argument. Set new runlevel to this argument.
[ "$1" != "" ] && runlevel=$1
if [ "$runlevel" = "" ]
then
echo "Usage: $0 <runlevel>" >&2
exit 1
fi
previous=$PREVLEVEL
[ "$previous" = "" ] && previous=N
export runlevel previous
# Is there an rc directory for this new runlevel?
if [ -d /etc/rc$runlevel.d ]
then
# First, run the KILL scripts.
if [ $previous != N ]
then
previous_prio=""
for i in /etc/rc$runlevel.d/K[0-9][0-9]*
do
# Check if the script is there.
[ ! -f $i ] && continue
# See if we changed priority.
prio=${i#/etc/rc$runlevel.d/K}
prio=${prio%%[a-z]*}
[ "$prio" != "$previous_prio" ] && wait
previous_prio=$prio
# Stop the service.
startup $i stop
done
fi
echo "Waiting for all stopped processes to finish..."
wait
echo "...all stopped processes finished."
# Now run the START scripts for this runlevel.
previous_prio=""
for i in /etc/rc$runlevel.d/S*
do
[ ! -f $i ] && continue
if [ $previous != N ] && [ $previous != S ]
then
#
# Find start script in previous runlevel and
# stop script in this runlevel.
#
suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
#
# If there is a start script in the previous level
# and _no_ stop script in this level, we don't
# have to re-start the service.
#
[ -f $previous_start ] && [ ! -f $stop ] && continue
fi
# See if we changed priority.
prio=${i#/etc/rc$runlevel.d/S}
prio=${prio%%[a-z]*}
[ "$prio" != "$previous_prio" ] && wait
previous_prio=$prio
case "$runlevel" in
0|6)
startup $i stop
;;
*)
startup $i start
;;
esac
done
echo "Waiting for all started processes to finish..."
wait
echo "...all started processes finished."
fi
# eof /etc/init.d/rc
- --
- --
Sebasti�n D. Criado - [EMAIL PROTECTED]
L.U.G.R.o - http://www.lugro.org.ar
GNU/Linux Registered User # 146768
- -------------------------------------------------------------------
"Si el Universo fuera un programa estar�a hecho en C, y correr�a sobre
un sistema UNIX"
An�nimo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9BUJb8hmHQ8ZCg0IRArtRAKCXJioZ92NHaDcatbV4wigTDsNamgCdHcz9
opWjJIZQSsVv7N0y1pLOu4k=
=BHnT
-----END PGP SIGNATURE-----