If you enter my subject line into Google and are feeling lucky, you will find Bill Clemontson's blog on the subject. I had slightly different needs than what he described though. Here's my deal.
Using a script, I want to start up a lisp session that runs as a web application server on a remote host. At arbitrary times, I wish to be able to connect to this lisp session and modify the running process.
I connect to the remote host using the 'ssh -X' command and run Emacs from there. That is the Emacs I want to connect to my running lisp.
I'm using SBCL on Linux (Debian/testing with my own 2.6.5 kernel). The SBCL is from CVS with sb-thread and sb-futex enabled. I've got KMR's cl-modlisp standing in for my application server at the moment. Its debug page is a good way to test that I've got Apache talking to SBCL.
I'm also using detachtty. I find this very convenient. Basicly, my only remaining problem (other than writing web applications) is to create a run control script for /etc/init.d/ so that SBCL can be started, stopped, and restarted in the same fashion as apache.
This seems to be working. This makes me very happy. I suppose I should mention that I have an sbclrc file that requires asdf and asdf-install. I am also using the var for the swank communication style rather than assuming :spawn. This works because the symbol was exported. The anounce-fn was not exported. I am using a simple lambda because it really doesn't need to do anything. Here is the script:
#!/bin/sh
# # Start SBCL as a detachtty process and start listening to Apache # # Swank is used so that SLIME can connect to the running process at # any time. Consider this a huge security hole. #
rm /home/david/usr/var/run/lisp-dribble 2>/dev/null rm /home/david/usr/var/run/detachtty.log 2>/dev/null rm /home/david/usr/var/run/lisp.pid 2>/dev/null rm /home/david/usr/var/run/lisp-socket 2>/dev/null
export SBCL_HOME=/home/david/usr/lib/sbcl
/usr/bin/detachtty --dribble-file /home/david/usr/var/run/lisp-dribble \ --log-file /home/david/usr/var/run/detachtty.log \ --pid-file /home/david/usr/var/run/lisp.pid \ /home/david/usr/var/run/lisp-socket \ /home/david/usr/bin/sbcl \ --eval "(asdf:operate 'asdf:load-op :modlisp)" \ --eval "(asdf:operate 'asdf:load-op :swank)" \ --eval "(ml:modlisp-start :port 3000)" \ --eval "(swank:create-swank-server 4005 swank:*communication-style* #'(lambda (p) p) t)"