#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/peermon
NAME=peermon
SNAME=peermon
DESC="Peer Monitoring Daemon"
PIDFILE="/var/run/$NAME.pid"
OPTIONS=" -p 2288 "
export TMPDIR=/tmp
# Apparently people have trouble if this isn't explicitly set...
if [ ! -d /etc/peermon ] ; then
echo "no /etc/peermon dir...exiting"
exit 1
fi
if [ ! -f /etc/peermon/machines.txt ] ; then
echo "no /etc/peermon/machines.txt file...exiting"
exit 1
fi
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
$DAEMON $OPTIONS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
pkill -SIGKILL $NAME
echo "$NAME."
;;
restart | force-reload)
echo -n "Restarting $DESC: "
pkill -9 $NAME
$DAEMON $OPTIONS
echo "$NAME."
;;
*)
N=/etc/init.d/$SNAME
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit 0