Forum OpenACS Q&A: Re: Newbie Installation

Collapse
7: Re: Newbie Installation (response to 1)
Posted by Frank N. on

Garn,

I couldn't get the supplied script to work with daemontools either. However the following, slightly edited one does the trick for me:

#!/bin/sh

exec su -l nsadmin -c "/usr/local/aolserver/bin/nsd -it /usr/local/aolserver/birdnotes.tcl"

Collapse
8: Re: Newbie Installation (response to 7)
Posted by Jeff Davis on
Frank, If you do "su -l nsadmin" your server will not be able to bind port 80. It should work fine on ports above 1024 though. Here is what I use:
#!/bin/sh
umask 002
export LD_LIBRARY_PATH=/usr/local/pgsql/lib/:$LD_LIBRARY_PATH
export PATH=/usr/local/pgsql/bin:$PATH
exec /usr/local/aolserver/bin/nsd -z -it /home/nsadmin/oatest.tcl -u nsadmin -g nsadmin 2>&1
Mark, it would be crazy to write a bad copy of init or daemontools in perl. It's certainly not that hard to write a passable c version for a single platform but really getting it right is tricky. I would look at supervise.c in deamontools if you want to get an idea of what something like that would look like.

As for what is wrong with inittab, in terms of starting a process, sitting there until it gets a sigchld, and restarting the process, inittab and daemontools are essentially the same. No advantage one way or the other. The big disadvantage with inittab is that it has one big file for all services and it's possible to break all the services started from inittab by messing up the inittab file (although I think maybe linux is a little more forgiving on this, on solaris I think a missing cr on the last line would break everything). It also means that anyone you want to allow to add or remove services have root (the material security issue). If the machine is just running your server and you are the only one using the box or you don't care if all the inittab things break, then use inittab . It works fine, it's secure, and it's already installed.

daemontools has some nice features though, your services are independent of one another and it provides a machanism for an unpriviledged user to restart (and send other signals) to their service (see svgroup in the docs for details). Also, the logging stuff and taking services up and down w/o editing is less error prone. I think if it wasn't a djb tool people would not have such religion about it and people would just use it since in general it is a better solution but it's not preinstalled and takes a little getting used to and does a few things in ways I dont like (it automatically starts things when added to the /service dir since I invariably link it with the wrong name -- I would rather things be down by default).

You can take a look at the faq and see if any of the reasons deamontools are better matter to you.