#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2
# description:  Gnunet is an anonymous distributed secure network
#               this server is required to connect to the network,
#               it will open a TCP port to communicate with the
#               GUI and an UDP port to communicate with the world.

depend() {
	need net
}

start() {
	ebegin "Starting gnunetd"
	# -u username, -c path to gnunet.conf file
	start-stop-daemon --start --quiet --background --exec /usr/bin/gnunetd \
		-- -u gnunet -c /var/lib/GNUnet/gnunet.conf
	eend $? "Failed to start gnunetd"
}

stop() {
	ebegin "Stopping gnunetd"
	# pointing file descriptors to /dev/null, because start-stop-daemon
	# prints warnings that it cannot kill process forks, 
	# but they are already dead
	start-stop-daemon --stop --quiet --user gnunet &>/dev/null
	eend $? "Failed to stop gnunetd"
}
