bogoserver

Fabio Fabbri fabio at llgp.org
Mon Aug 22 18:21:10 UTC 2005


In these days I was thinking on a way to implement concurrent startup.

I wrote a daemon that may receive requests through TCP. I called it 
"bogoserver" because now it's simple and bogus, but it may become a very 
powerful daemon.

/ect/init.d/rc can launch startup scripts with "startup $i start &", so 
scripts are executed concurrently; but startup() must be modified and 
should ask to bogoserver if the script dependencies are satisfied. After 
the script is executed, startup() must notify this to bogoserver.

To do this, startup() must execute a function that gets the dependencies 
of this script. Dependencies may be obtained parsing the script as 
defined on LSB, but I think the function may also read dependencies from 
a config file, so we don't need to edit every script and we may override 
easily the dependencies.

Then startup() can send a message to bogoserver for each dependency. 
Unfortunately, Debian's bash doesn't supports TCP, so we must use netcat 
and execute "echo wait wantedService | nc localhost $BOGOSERVER_PORT". 
This will lock this istance of startup() until bogoserver returns a 
message and closes the socket. This may happen immediately, or after the 
execution of wantedService.

After the execution of the script, startup() must do "echo started $1 | 
nc localhost $BOGOSERVER_PORT", so bogoserver can unlock other istances 
of startup and the boot can go on.

This is the new startup():
startup() {
#getDependencies not yet implemented
   DEPENDS=$(getDependencies $1);
   for i in $DEPENDS; do
     echo "wait $i" | nc localhost $BOGOSERVER_PORT
   done
   case "$1" in
     *.sh)
         $debug sh "$@"
         ;;
     *)
         $debug "$@"
         ;;
   esac
   echo started $1 | nc localhost $BOGOSERVER_PORT
   fi
}

You can download the source of bogoserver from 
http://bootster.berlios.de/bogoserver/bogoserver-0.0.1.c

I think it may be improved in some way, for example it uses a linked 
lists to keep track of services. However, the number of startup services 
is generally low, and structure with lower computational complexity may 
have lower performances!

Then bogoserver doesn't handle yet change of runlevel or shutdown, but 
just boot. This is just the first version, you can help me and improve it!

Please ask if I was not clear, and send some feedback!

Regards
Fabio



More information about the initscripts-ng-devel mailing list