#!/bin/sh
#
# Start/Stop/HUP/etc MARS_NWE server
#
# Copyright 2000 Wilmer van der Gaast (lintux@dds.nl)
#

#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

. $WEBSERVE_ROOT/cgi-bin/functions
. $WEBSERVE_ROOT/smart.conf

checkrefer

echo Content-Type: text/html
echo

case $1 in
	start )
		$NWSERV_BIN     < /dev/null 2> /dev/null > /dev/null &
;;
	stop )
		cat << EOF
<HTML>
<HEAD>
<TITLE>Stopping MARS_NWE</TITLE>
</HEAD>
<BODY BGCOLOR=#C0C0C0>
Please wait while <TT>MARS_NWE</TT> is shutting down...<BR>
<PRE>
EOF
		$NWSERV_BIN -k
		cat << EOF
</PRE>
<TT>MARS_NWE</TT> is down now. You can click
<A HREF="/cgi-bin/control?start">here</A> to restart <TT>MARS_NWE</TT>.
</BODY>
</HTML>
EOF
	exit
;;
	hup )
		$NWSERV_BIN -h  < /dev/null 2> /dev/null > /dev/null &
;;
esac

cat $WEBSERVE_ROOT/start.html
