mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2008-03-11 Manuel Arostegui <marostegui@artica.es>
* pandora_server, pandora_network, pandora_recon: Added pidof checking to check the PID of the process. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@746 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dddc80bee2
commit
5cfd5b4353
@ -1,3 +1,8 @@
|
|||||||
|
2008-03-11 Manuel Arostegui <marostegui@artica.es>
|
||||||
|
|
||||||
|
* pandora_server, pandora_network, pandora_recon:
|
||||||
|
Added pidof checking to check the PID of the process.
|
||||||
|
|
||||||
2008-03-06 Sancho Lerena <slerena@gmail.com>
|
2008-03-06 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
* conf/pandora_server.conf: New tokens for the new servers.
|
* conf/pandora_server.conf: New tokens for the new servers.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
||||||
PANDORA_PID_PATH="/var/run/pandora"
|
PANDORA_PID_PATH="/var/run"
|
||||||
PANDORA_PID=$PANDORA_PID_PATH/pandora_network.pid
|
PANDORA_PID=$PANDORA_PID_PATH/pandora_network.pid
|
||||||
PANDORA_DAEMON=/usr/local/bin/pandora_network
|
PANDORA_DAEMON=/usr/local/bin/pandora_network
|
||||||
|
|
||||||
@ -28,44 +28,37 @@ fi
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
OLD_PATH="`pwd`"
|
OLD_PATH="`pwd`"
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ ! -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
CHECK_PID=`cat $PANDORA_PID`
|
echo "Pandora FMS Network Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
|
||||||
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_network" | wc -l`
|
exit 1
|
||||||
if [ $CHECK_PID_RESULT == 1 ]
|
else
|
||||||
then
|
rm -f $PANDORA_PID
|
||||||
echo "Pandora FMS Network Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PANDORA_DAEMON $PANDORA_HOME -D
|
$PANDORA_DAEMON $PANDORA_HOME -D
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
MYPID=`ps aux | grep "$PANDORA_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
if [ ! -z "$MYPID" ]
|
if [ ! -z "$PANDORA_PID" ]
|
||||||
then
|
then
|
||||||
echo $MYPID > $PANDORA_PID
|
echo "Pandora Network Server is now running with PID $PANDORA_PID"
|
||||||
echo "Pandora Network Server is now running with PID $MYPID"
|
|
||||||
else
|
else
|
||||||
echo "Cannot start Pandora FMS Network Server. Aborted."
|
echo "Cannot start Pandora FMS Network Server. Aborted."
|
||||||
fi
|
fi
|
||||||
cd "$OLD_PATH"
|
cd "$OLD_PATH"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
echo "Stopping Pandora FMS Network Server"
|
echo "Pandora FMS Network Server is not running, cannot stop it."
|
||||||
PID_2=`cat $PANDORA_PID`
|
exit 1
|
||||||
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'pandora_network' `" ]
|
|
||||||
then
|
|
||||||
kill `cat $PANDORA_PID` 2> /dev/null > /dev/null
|
|
||||||
else
|
|
||||||
echo "Pandora FMS Network Server is not executing with PID $PID_2, skip Killing step"
|
|
||||||
fi
|
|
||||||
rm -f $PANDORA_PID
|
|
||||||
else
|
else
|
||||||
echo "Pandora FMS Network Server is not running, cannot stop it."
|
echo "Stopping Pandora FMS Network Server"
|
||||||
|
kill $PANDORA_PID > /dev/null 2>&1
|
||||||
|
rm -f $PANDORA_PID
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
force-reload|restart)
|
force-reload|restart)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
||||||
PANDORA_PID_PATH="/var/run/pandora"
|
PANDORA_PID_PATH="/var/run"
|
||||||
PANDORA_PID=$PANDORA_PID_PATH/pandora_recon.pid
|
PANDORA_PID=$PANDORA_PID_PATH/pandora_recon.pid
|
||||||
PANDORA_DAEMON=/usr/local/bin/pandora_recon
|
PANDORA_DAEMON=/usr/local/bin/pandora_recon
|
||||||
|
|
||||||
@ -28,42 +28,35 @@ fi
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
OLD_PATH="`pwd`"
|
OLD_PATH="`pwd`"
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ ! -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
CHECK_PID=`cat $PANDORA_PID`
|
echo "Pandora FMS Recon Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
|
||||||
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_recon" | wc -l`
|
exit 1
|
||||||
if [ $CHECK_PID_RESULT == 1 ]
|
|
||||||
then
|
|
||||||
echo "Pandora FMS Recon Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PANDORA_DAEMON $PANDORA_HOME -D
|
$PANDORA_DAEMON $PANDORA_HOME -D
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
MYPID=`ps aux | grep "$PANDORA_DAEMON" | grep -v grep | tail -1 | awk '{print $2}'`
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
if [ ! -z "$MYPID" ]
|
if [ ! -z "$PANDORA_PID" ]
|
||||||
then
|
then
|
||||||
echo $MYPID > $PANDORA_PID
|
echo "Pandora Recon Server is now running with PID $PANDORA_PID"
|
||||||
echo "Pandora Recon Server is now running with PID $MYPID"
|
|
||||||
else
|
else
|
||||||
echo "Cannot start Pandora FMS Recon Server. Aborted."
|
echo "Cannot start Pandora FMS Recon Server. Aborted."
|
||||||
fi
|
fi
|
||||||
cd "$OLD_PATH"
|
cd "$OLD_PATH"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
echo "Stopping Pandora FMS Recon Server"
|
echo "Pandora FMS Recon Server is not running, cannot stop it."
|
||||||
PID_2=`cat $PANDORA_PID`
|
exit 1
|
||||||
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'pandora_recon' `" ]
|
|
||||||
then
|
|
||||||
kill `cat $PANDORA_PID` 2> /dev/null > /dev/null
|
|
||||||
fi
|
|
||||||
rm -f $PANDORA_PID
|
|
||||||
else
|
else
|
||||||
echo "Pandora FMS Recon Server is not running, cannot stop it."
|
echo "Stopping Pandora FMS Recon Server"
|
||||||
|
kill $PANDORA_PID > /dev/null 2>&1
|
||||||
|
rm -f $PANDORA_PID
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
force-reload|restart)
|
force-reload|restart)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# Configurable path and filenames
|
# Configurable path and filenames
|
||||||
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
PANDORA_HOME="/etc/pandora/pandora_server.conf"
|
||||||
PANDORA_PID_PATH="/var/run/pandora"
|
PANDORA_PID_PATH="/var/run"
|
||||||
PANDORA_PID=$PANDORA_PID_PATH/pandora_dataserver.pid
|
PANDORA_PID=$PANDORA_PID_PATH/pandora_dataserver.pid
|
||||||
PANDORA_DAEMON=/usr/local/bin/pandora_server
|
PANDORA_DAEMON=/usr/local/bin/pandora_server
|
||||||
|
|
||||||
@ -28,42 +28,37 @@ fi
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
OLD_PATH="`pwd`"
|
OLD_PATH="`pwd`"
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ ! -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
CHECK_PID=`cat $PANDORA_PID`
|
echo "Pandora FMS Data Server is currently running on this machine with PID ($PANDORA_PID). Aborting now..."
|
||||||
CHECK_PID_RESULT=`ps aux | grep -v grep | grep "$CHECK_PID" | grep "pandora_server" | wc -l`
|
exit 1
|
||||||
if [ $CHECK_PID_RESULT == 1 ]
|
else
|
||||||
then
|
rm -f $PANDORA_PID
|
||||||
echo "Pandora FMS Data Server is currently running on this machine with PID ($CHECK_PID). Aborting now..."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PANDORA_DAEMON $PANDORA_HOME -D
|
$PANDORA_DAEMON $PANDORA_HOME -D
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
MYPID=`ps aux | grep "$PANDORA_DAEMON" | grep -v grep | tail -1 | awk '{print $2}'`
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
if [ ! -z "$MYPID" ]
|
if [ ! -z "$PANDORA_PID" ]
|
||||||
then
|
then
|
||||||
echo $MYPID > $PANDORA_PID
|
echo "Pandora Data Server is now running with PID $PANDORA_PID"
|
||||||
echo "Pandora Data Server is now running with PID $MYPID"
|
|
||||||
else
|
else
|
||||||
echo "Cannot start Pandora FMS Data Server. Aborted."
|
echo "Cannot start Pandora FMS Data Server. Aborted."
|
||||||
fi
|
fi
|
||||||
cd "$OLD_PATH"
|
cd "$OLD_PATH"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
if [ -f $PANDORA_PID ]
|
PANDORA_PID=$(pidof -x $PANDORA_DAEMON)
|
||||||
|
if [ -z $PANDORA_PID ]
|
||||||
then
|
then
|
||||||
echo "Stopping Pandora FMS Data Server"
|
echo "Pandora FMS Data Server is not running, cannot stop it."
|
||||||
PID_2=`cat $PANDORA_PID`
|
exit 1
|
||||||
if [ ! -z "`ps -F -p $PID_2 | grep -v grep | grep 'pandora_server' `" ]
|
|
||||||
then
|
|
||||||
kill `cat $PANDORA_PID` 2> /dev/null > /dev/null
|
|
||||||
fi
|
|
||||||
rm -f $PANDORA_PID
|
|
||||||
else
|
else
|
||||||
echo "Pandora FMS Data Server is not running, cannot stop it."
|
echo "Stopping Pandora FMS Data Server"
|
||||||
|
kill $PANDORA_PID > /dev/null 2>&1
|
||||||
|
rm -f $PANDORA_PID
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
force-reload|restart)
|
force-reload|restart)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user