(View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide)

swiki server

Here is an init script for debian linux. The only things that have to be changed are:

(Save this as Text to use it or better (less fiddling) use the gzipped version.) It can then be copied into /etc/init.d
cp swiki /etc/init.d
its permissions corrected / made executable with
chown root:root /etc/init.d/swiki
chmod 755 /etc/init.d/swiki
and then the appropriate symlinks have to be set to automate start and stop:

update-rc.d swiki defaults 90 14
———cut here————-

#!/bin/sh
#
# swiki
# swiki init script, debian style
#
# Version: @(#)swiki 1.1 08-Aug-2002 t3 - copying: GPL
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DIR=/home/swiki/ComSwiki
DAEMON=/home/swiki/ComSwiki/squeak
NAME=squeak
ARGS="-headless -memory 120m squeak.image"
DESC="swiki"

test -x $DAEMON || exit 0

set -e
#set -x

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
su -s /bin/bash -c "(cd $DIR && $DAEMON $ARGS &)" - swiki
#start-stop-daemon -b --start --chuid swiki --exec $DAEMON -- $ARGS
#start-stop-daemon -b --start --quiet --chuid swiki --exec $DAEMON -- $ARGS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME "
start-stop-daemon --stop --quiet --name $NAME
echo "."
;;
#reload)
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo -n "Reloading $DESC configuration..."
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
# echo "done."
#;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
echo "."
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0



-----------

Link to this Page