#!/bin/sh

prefix="/opt"
PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin

start() {
	echo "starting pyLoad"
	pyload --daemon --configdir=/opt/var/pyload
	}

stop() {
	echo "stopping pyLoad"
	pyload --quit --configdir=/opt/var/pyload
	}

status() {
	pyload --status --configdir=/opt/var/pyload
	}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		sleep 4
		start
		;;
	status) status
		;;
	*)
		echo "Usage: $0 (start|stop|restart|status)"
		exit 1
		;;
esac

exit 0