#!/bin/bash
#
# expression	Start the expression HTTP server.
#
# The variables below are NOT to be changed.  They are there to make the
# script more readable.  Look in /etc/defaults/apache for editable variables.

NAME=expression
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONF=/etc/$NAME/config.xml

case "$1" in
  start)
    echo -n "Starting web server: $NAME"
    $ENV start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON > /dev/null
    ;;

  stop)
    echo -n "Stopping web server: $NAME"
    start-stop-daemon --stop --pidfile $PIDFILE --oknodo
    ;;

  restart)
    echo -n "Restarting $NAME"
    if ! start-stop-daemon -q --stop --pidfile $PIDFILE --signal HUP; then
	$ENV start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON > /dev/null
    fi
    ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart}"
    exit 1
    ;;
esac

if [ $? -eq 0 ]; then
	echo .
	exit 0
else
	echo " failed"
	exit 1
fi
