Re: Universal method to start a script at boot

From: Denis Vlasenko
Date: Mon Sep 12 2005 - 06:15:50 EST


On Monday 12 September 2005 14:07, DervishD wrote:
> Hi Denis :)
>
> * Denis Vlasenko <vda@xxxxxxxxxxxxx> dixit:
> > Awful. This codifies ages-old Unix traditional SysV-like init
> > and its derivatives, which should be get rid of instead.
>
> I'm with you in this, in fact I use my own init system, but...
>
> > daemontools are absolutely wonderful way of controlling daemons.
>
> How the heck you make sure that svscan starts the services in the
> correct order?

Simple. Usually I do not, because many of them do not
depend on each other. In cases where I must, I code it
in the script.

This is how do I wait for automount to start before
I mkswap/swapon on a windows nt swapfile:

echo -n "* Setting up swap"
i=9; while test "$i" -gt 0; do
if test -d /mnt/auto/vfat.hda1; then
echo
mkswap /mnt/auto/vfat.hda1/PAGEFILE.SYS
swapon /mnt/auto/vfat.hda1/PAGEFILE.SYS
exit
fi
echo -n "."
sleep 1
let i-=1; done
echo

Probably a small tool can make it look less ugly
(say, 'waitfor <seconds> <cmd> [<param>]'):

if waitfor 10 test -d /mnt/auto/vfat.hda1; then ...; fi

> > Does it run the services in /services in any
> particular order or just in the order resulting for a simple
> globbing? How you make sure the services are shut down in any
> particular order?
>
> All this seems like requiring scripts to do the job (that is,
> ensuring a particular order of startup/shutdown), while sysvinit
> gets this info from filenames. Obviously, dictating the order using a
> script is far more flexible than using filenames but it's not as
> simple, and that cannot be seen in the comparisons D.J.B. does in the
> homepage of daemontools (which, BTW, is the only source of
> documentation, and a very poor one). LSB, on the other hand, is

djb is crazy genius, what did you expect ;)
There is GPLed replacement of daemontools at http://smarden.org/runit/

> better structured and although I don't like sysvinit at all, the
> system is better documented. And I hate runlevels...

me too.
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/