[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] running commands before and after connecting

Wouter Verhelst wrote:

I'm currently thinking about implementing an option for the config file
to allow one to run a script after a client connects (but before the
server starts serving or tries to open any files), and the same for
after a client disconnects. The point of this feature would be

Hi Wouter!

Heh, this was EXACTLY the reason why we wanted the inetd support in
nbd, as this was what we were using it for.  On the ltsp project, here,
for instance, is our nbdswapd, started from inetd:


# copyright 2006 Vagrant Cascadian <vagrant@...131...>, distributed under
# the terms of the GNU General Public License version 2 or any later version.

<snip stuff>

# generate the swap file
dd if=/dev/zero of=$SWAP bs=1024k count=$SIZE 2> /dev/null

if [ "$RUN_MKSWAP" = "true" ]; then
    /sbin/mkswap $SWAP > /dev/null 2>&1

# start the swap server
/bin/nbd-server 0 $SWAP $NBD_SERVER_OPTS

# clean up the swap file
rm -f $SWAP

So, we were handling what you were proposing, but by a slightly different
method.  Yours is just as good as ours, and I, personally, would be fine
with either.

If, however, I might make a suggestion, that at least from a packaging
point of view, would make things easier?

Instead of having a monolithic nbd.conf file, I'm a huge fan of the
config dir model, with each service getting it's own file.  That way,
packaging wise, we're not having to mess with anyone else's config,
but rather, can just drop our own config file in.

I'm up to my butt in alligators right at the moment with the next
Edubuntu release, but if you're interested, I'd be more than happy
to code that up for you, and send a patch, in the September to October



Scott L. Balneaves | "Eternity is a very long time,
Systems Department |  especially towards the end."
Legal Aid Manitoba |    -- Woody Allen

Reply to: