#! /bin/sh
#
# re_jackmixer init.d script
# run re_restream and jackd from this script

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

set -e
LOGFILE="/var/log/streamswitch.log"


case "$1" in
  start)
	echo -n "Starting re_codec: streamswitch"
	restream.py > $LOGFILE &
	echo "."
	;;
  stop)
	echo -n "Stopping re_codec: streamswitch"
	kill `ps ax | grep streamswitch.py | grep -v grep | cut -f1 -dp`
	echo "."
	;;
  restart|force-reload)
	$0 stop
	sleep 1
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
