Jim Jim - 7 months ago 32
Linux Question

nohup SBCL ubuntu couldn't read from standard input

On Ubuntu I compiled sbcl 1.0.35 with threading. I can happily use sbcl from the command line and my hunchentoot website works with threading but when I logout it's gone. When I attempt to nohup sbcl

nohup ./src/runtime/sbcl --core output/sbcl.core

I get

(SB-IMPL::SIMPLE-STREAM-PERROR "couldn't read from ~S" # 9)

I've attempted various combinations of redirecting the standard input to /dev/null or a file and using the script command line option but I don't quite get what is going on.

How do I start sbcl from the command line on linux with nohup and keep my repl(website) running?

Jim Jim

Dmity-vk sent me on the right track, thank you. SBCL tries to start a repl when you start it up, and reads from the standard in. When you use nohup the standard in is redirected and cannot be read. SBCL then drops to the debugger which tries to read from standard in ... hence the endless loop. The --script tag comes close to solving this except that it has a (quit) once the script has been read. So I put an endless loop in my script and voila.

so on an ubuntu server with sbcl this should let you start a hunchentoot server

sudo nohup ./run-sbcl.sh --script foo.lisp > /dev/null 2> /dev/null &

where foo.lisp has as its last lines something like

(defvar *alive* t)

(loop (sleep 1000) (if (not *alive*) (quit)))