38 lines
958 B
Text
38 lines
958 B
Text
#!/sbin/runscript
|
|
# Copyright 1999-2008 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
# $Header: /var/cvsroot/gentoo-x86/net-p2p/fms/files/fms,v 1.4 2010/03/31 19:19:27 tommy Exp $
|
|
|
|
# Check for OpenRC/Baselayout 2 - see bug #270646
|
|
is_openrc() {
|
|
[ -f /lib/librc.so -o -f /etc/init.d/sysfs -o -f /lib/rc/version ]
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting FMS"
|
|
if is_openrc; then
|
|
start-stop-daemon -S -u freenet:freenet -d /var/freenet/fms -b -x /usr/bin/fms
|
|
eend $?
|
|
else
|
|
cd /var/freenet/fms
|
|
su -s /bin/sh -c "fms --daemon" freenet
|
|
eend $?
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping FMS"
|
|
if is_openrc; then
|
|
start-stop-daemon -K -u freenet:freenet -d /var/freenet/fms /usr/bin/fms
|
|
eend $?
|
|
else
|
|
pkill -u freenet -f "fms --daemon"
|
|
eend 0
|
|
fi
|
|
if [[ $RC_CMD == "restart" ]]; then
|
|
ebegin "Waiting a few seconds to be sure FMS is ready for restart"
|
|
sleep 10
|
|
#give fms time to stop and release the nntp port
|
|
fi
|
|
}
|
|
|