#!/bin/sh ### BEGIN INIT INFO # Provides: dotlrn # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Should-Start: $postgresql # Should-Stop: $postgresql # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: dotLRN e-learning and community system ### END INIT INFO # # Start the AOLServer HTTP server with dotLRN. # NAME=dotlrn USER=www-data GROUP=www-data CONF=/etc/dotlrn/config.tcl ADDRESS=$(grep "^set address" $CONF | sed 's/set//;s/address//;s/^[ \t]*//') PORT=$(grep "^set httpport" $CONF | sed 's/set//;s/httpport//;s/^[ \t]*//') PIDFILE=/var/run/aolserver4/$NAME.pid PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/sbin/aolserver4-nsd trap "" 1 [ -f $DAEMON ] || exit 0 start() { echo -n "Starting web server: $NAME" start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE --oknodo -- \ -u $USER -g $GROUP -b $ADDRESS:$PORT -t $CONF >/dev/null 2>&1 if [ $? != 0 ]; then echo " ... failed" exit 1 else echo "." fi } stop() { echo -n "Stopping web server: $NAME" start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo >/dev/null 2>&1 if [ $? != 0 ]; then echo " ... failed" exit 2 else echo "." fi } case "$1" in start) start ;; stop) stop ;; reload|force-reload|restart) stop sleep 2 start ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" exit 1 ;; esac exit 0