[Ecls-list] [creelman.david at gmail.com: ECL serving http via hunchentoot, how do I get it to stay up?]

Pascal J. Bourguignon pjb at informatimago.com
Fri Aug 17 09:09:47 UTC 2012

David Creelman <creelman.david at gmail.com> writes:

> Hi All,
> I've setup a tiny server with ECL and I've quicklisp'ed the hunchentoot
> package and it works well when I start it from the REPL.
> However, If I try and run ECL as a background task which in turn is setting up
> my hunchentoot instance, ECL will stop after a variable amount of time (usually
> 5-10 minutes).
> I'm new to serving up pages via CL and ECL, has anyone had any luck with this?
> Should I embed ECL into an exe that runs hunchentoot rather than running ECL?
> Or, if I run the server as a script, is there some way to get the script to
> not need to interact with the REPL (which I think is the problem)?

It's better to start CL servers in detached terminals (you may use
detachtty or screen).  Then if there's a bug, you get a debugger in the
terminal that you can remotely access and debug.

This of course doesn't prevent you to try to catch errors and to handle
them.  IIRC, hunchentoot has options for that.

I use something like:

    su -c 'screen -d -m -t server -c /home/USER/etc/screenrc \
                  bash -c  "export LC_CTYPE=en_US.UTF-8 ; while sleep 2 ; do \
                             /home/USER/bin/SERVER ; done"' \
        - USER

in the server init.d files to start CL servers.  Notice how the server
process is restarted after 2 seconds if it ever crashes.

detachtty is more lightweight.  http://www.cliki.net/detachtty

__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.

More information about the ecl-devel mailing list