You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-p2p/bitflu/files/bitflu.initd

47 lines
887 B

#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
DAEMON=/usr/sbin/bitflu.pl
PIDDIR=/var/run/bitflu
PIDFILE=${PIDDIR}/bitflu.pid
CONFFILE=/etc/bitflu/bitflu.config
depend() {
need net
}
checkconfig() {
if [ ! -f ${CONFFILE} ]; then
eerror "No config file ${CONFFILE}"
return 1
fi
if [ ! -d ${PIDDIR} ] && ! mkdir -p ${PIDDIR}; then
eerror "Failed to create ${PIDDIR}"
return 1
fi
chown bitflu:bitflu ${PIDDIR}
}
start() {
checkconfig || return 1
ebegin "Starting bitflu"
start-stop-daemon --start --pidfile "${PIDFILE}" --user bitflu:bitflu \
--exec "${DAEMON}" -- --config="${CONFFILE}" --daemon -q >/dev/null 2>&1
eend $?
}
stop() {
ebegin "Stoping bitflu"
start-stop-daemon --stop --pidfile "${PIDFILE}" --exec "${DAEMON}"
eend $?
}
restart() {
svc_stop
sleep 2
svc_start
}