#!/bin/sh
#
# run-nocatbox 
#
#	Este script arranca y para los servicios de nuestro NoCatBox
#

# Source networking configuration.
. /etc/sysconfig/network
. /etc/sysconfig/wireless_network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/local/nocat/gateway/bin/gateway ] || exit 0

# See how we were called.
case "$1" in
  start)
	# Start daemons.
	echo -n "Starting nocat gateway: "
	echo -n " Bringing up interface ${INTERFACE}"
	/sbin/ifconfig ${INTERFACE} up
	echo
	/sbin/ifconfig ${INTERFACE} ${IP} netmask ${NETMASK} broadcast ${BROADCAST} 
	echo
	echo -n "Restarting dhcpd"	
	/etc/rc.d/init.d/dhcpd restart
	echo
	echo -n "Starting gateway"
	# eth1
	/usr/local/nocat/gateway/bin/gateway
	echo
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down nocat gateway "
	killall gateway
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: wireless_nocat {start|stop|restart}"
	exit 1
esac

exit 0
