#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public Licence v2

start() {
	local pydoc_port="${@PYDOC_PORT_VARIABLE@-${PYDOC_PORT}}"

	if [ -z "${pydoc_port}" ]; then
		eerror "Port not set"
		return 1
	fi

	ebegin "Starting pydoc server on port ${pydoc_port}" 
	start-stop-daemon --start --background --make-pidfile \
			  --pidfile /var/run/@PYDOC@.pid \
			  --exec /usr/bin/@PYDOC@ -- -p "${pydoc_port}"
	eend $?
}

stop() {
	ebegin "Stopping pydoc server"
	start-stop-daemon --stop --quiet --pidfile /var/run/@PYDOC@.pid
	eend $?
}
