Automatic Startup

Lex Spoon lex at cc.gatech.edu
Sat Apr 2 14:27:46 UTC 2005


> > 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.

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



More information about the Squeak-dev mailing list