pandorafms/pandora_server/util/SLES10/pandora_prediction

62 lines
1.3 KiB
Bash

#!/bin/bash
# Pandora FMS Prediction Server, startup script
# Sancho Lerena, <slerena@gmail.com>
# SLES 10
# v2.0 build 081111
# Configurable path and filenames
PANDORA_HOME="/etc/pandora/pandora_server.conf"
PANDORA_DAEMON=/usr/bin/pandora_prediction
# Main script
if [ ! -f $PANDORA_DAEMON ]
then
echo "Pandora FMS Prediction Server not found, please check setup and read manual"
exit
fi
case "$1" in
start)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z $PANDORA_PID ]
then
echo "Pandora FMS Prediction Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
exit 1
fi
$PANDORA_DAEMON $PANDORA_HOME -D
sleep 1
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ ! -z "$PANDORA_PID" ]
then
echo "Pandora FMS Prediction Server is now running with PID $PANDORA_PID"
else
echo "Cannot start Pandora FMS Prediction Server. Aborted."
fi
;;
stop)
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
if [ -z "$PANDORA_PID" ]
then
echo "Pandora FMS Prediction Server is not running, cannot stop it."
exit 1
else
echo "Stopping Pandora FMS Prediction Server"
kill $PANDORA_PID
fi
;;
force-reload|restart)
$0 stop
sleep 10
$0 start
;;
*)
echo "Usage: pandora_prediction {start|stop|restart}"
exit 1
esac