#!/bin/bash # Pandora FMS Network Server, startup script # Sancho Lerena, # Linux Version (generic) # v1.3 Build 070731 # Configurable path and filenames PANDORA_HOME="/etc/pandora/pandora_server.conf" PANDORA_PID_PATH="/var/run" PANDORA_PID=$PANDORA_PID_PATH/pandora_network.pid PANDORA_DAEMON=/usr/local/bin/pandora_network # Main script if [ ! -d "$PANDORA_PID_PATH" ] then echo "Pandora FMS cannot write it's PID file in $PANDORA_PID_PATH. Please create that directory" exit fi if [ ! -f $PANDORA_DAEMON ] then echo "Pandora FMS Network Server not found, please check setup and read manual" exit fi case "$1" in start) OLD_PATH="`pwd`" PANDORA_PID=$(pidof -x $PANDORA_DAEMON) if [ ! -z $PANDORA_PID ] then echo "Pandora FMS Network Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..." exit 1 else rm -f $PANDORA_PID fi $PANDORA_DAEMON $PANDORA_HOME -D sleep 1 PANDORA_PID=$(pidof -x $PANDORA_DAEMON) if [ ! -z "$PANDORA_PID" ] then echo "Pandora Network Server is now running with PID $PANDORA_PID" else echo "Cannot start Pandora FMS Network Server. Aborted." fi cd "$OLD_PATH" ;; stop) PANDORA_PID=$(pidof -x $PANDORA_DAEMON) if [ -z $PANDORA_PID ] then echo "Pandora FMS Network Server is not running, cannot stop it." exit 1 else echo "Stopping Pandora FMS Network Server" kill $PANDORA_PID > /dev/null 2>&1 rm -f $PANDORA_PID fi ;; force-reload|restart) $0 stop $0 start ;; *) echo "Usage: pandora_network {start|stop|restart}" exit 1 esac