I’ve been fiddling with Sacraspot lately and I discovered that the technique I’ve been using to daemonize the server and integrate it into my init-environment wasn’t working properly. This is a lisp application which I was running with start-stop-daemon. The problem was that for some reason, start-stop-daemon was failing to fully daemonize the application. The Repl seemed to conflict with start-stop-daemon’s ability to do this properly and while it would look like it worked at first, once one closed the shell which lisp was started from, the lisp process would close.
Anyway, I ended up changing the initscript from this:
start-stop-daemon --start --exec /usr/bin/sbcl \ --pidfile /path/to/pid -m -b \ --user sacraspot \ --chdir /path/to/sacraspot \ --progress \ -- --core sacraspot.core --eval "(in-package #:sacraspot)" \ --eval "(initialize)" \ --eval "(startup)"
start-stop-daemon --start --exec /usr/bin/detachtty \ --user sacraspot \ --chdir /path/to/sacraspot \ --progress \ -- --dribble-file sacraspot.dribble \ --log-file messages \ --pid-file /path/to/pid \ /tmp/sacraspot.socket \ /usr/bin/sbcl --core sacraspot.core --eval "(in-package #:sacraspot)" \ --eval "(initialize)" \ --eval "(startup)"
This seems to work. It doesn’t provide any special ability to attach or detach from the process like other solutions I’ve seen but it integrates perfectly with the init setup. I use swank to attach and detach separately so I think I’ve got that well underhand.