Can Squeak be started as a daemon process? If not, how would you
suggest to configure the machine so each time it's rebooted, Squeak
will be launched?
--
On Debian you can use start-stop-daemon in rcX.d scripts to
launch/shutdown programs that do not fork.
--
Yeah. Here's my startup script to run my local Swiki. You'll need to
tweak the paths, usernames, etc. but this should show how to do it.
start-stop-daemon is great!
After installing this script in /etc/init.d, you need to cause it to
get run. I use file-rc, and so I edit /etc/runlevel.conf to
accomplish this. With the default setup, you have to create symbolic
links in the /etc/rc?.d directories. ( update-rc.d lexswiki defaults )
Overall, there certainly are an annoying number of steps to getting
something to start after every reboot, but it is all straightforward.
Given start-stop-daemon, you can make Squeak auto-start at boot time
much like you'd do so for any other Unix program (sendmail, apache,
squid, whatever).
-Lex
#! /bin/sh # # lexswiki Startup script for Lex's Swikis #
NAME=lexswiki DESC="Lex's Swikis" PIDFILE=/var/run/$NAME.pid
SQUEAKVM=/usr/bin/squeakvm
SSDAEMON_ARGS="--pidfile $PIDFILE --exec $SQUEAKVM"
[ ! -f /etc/default/$NAME ] || . /etc/default/$NAME
[ -x $SQUEAKVM ] || exit 0
set -e
case "$1" in start) echo -n "Starting $DESC..." start-stop-daemon
$SSDAEMON_ARGS --start --background --make-pidfile --chuid lex --chdir
/home/lex/swiki -- -headless echo "" ;; stop) echo -n "Stopping
$DESC..." start-stop-daemon $SSDAEMON_ARGS --stop rm -f $PIDFILE #
because start-stop-daemon doesn't do this echo "" ;; restart) $0 stop
$0 start ;;
*) echo "Usage: /etc/init.d/$NAME {start|stop|restart}" exit 3 ;;
esac
exit 0
You might want to have a look at Dan Bernstein's daemontools
(http://cr.yp.to/daemontools.html). Once installed, daemontools
monitors processes defined under a /service directory, bringing them
up automatically on boot. The benefit over a simple init script is
that daemontools continues to monitor launched processes,
resurrecting any that die unexpectedly.
--
+1 from me. We use it on the SqF box as well. The startup script is
'run' and is simply something like:
#!/bin/sh setuidgid squeakuser squeak -headless foo.image
(setuidgid is a utility from daemontools that sets the uid&gid to that
of 'squeakuser', then starts the rest of the command line).
A process will monitor this script, and as soon as it exits (because
squeak dies) it will be restarted. Can't get it much simpler than that