pandorafms/pandora_server/util/tentacle_serverd
slerena aa3a4a0b90 2009-12-18 Sancho Lerena <slerena@artica.es>
* pandora_server.spec: Added xprobe2 dep (we made the xprobe2 rpm package
	so now it's possible to satisfy dependency). Alter all paths to binary from
	/usr/local/bin to /usr/bin. Other minor issues in RPM fixed.

	* pandora_server_installer: Added description to get deps from zypper and yum.
	Installing services in debian/ubunty systems with update-rc.d. 
	Make check to link from /usr/local/bin to /usr/bin if install
	deploy binary at /usr/local. /usr/bin is the new default.

	* pandora_server_upgrade: /usr/bin as new default. Link issue fixed.

	* DEBIAN/make_deb_package.sh: Fixed Makefile replace regexp to replace all 
	target binary to put then in the jail under /usr/bin path.

	* DEBIAN/postinst: Fixed path for tentacle_server at /usr/bin

	* DEBIAN/prerm: Using native debian commands to remove services.

	* Tools.pm: If there is a problem loading something in the enterprise, show it
	to log.

	* util/pandora_server,
	util/tentacle_serverd: new path to /usr/bin/
	
	* pandora_server.conf: new path for pandora_exec to /usr/bin/

	* util/plugin/udp_nmap_plugin.sh: Check parameters before calling to namp.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2220 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-12-18 18:22:33 +00:00

145 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) 2005-2009 Artica ST
#
# Author: Sancho Lerena <slerena@artica.es> 2006-2009
#
# /etc/init.d/tentacle_server
#
# System startup script for Tentacle Server
#
### BEGIN INIT INFO
# Provides: tentacle_server
# Required-Start: $network
# Should-Start: $syslog
# Required-Stop: $network
# Should-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Tentacle Server startup script
# Description: Tentacle Server startup script
### END INIT INFO
# Check for SUSE status scripts
if [ -f /etc/rc.status ]
then
. /etc/rc.status
rc_reset
else
# Define rc functions for non-suse systems, "void" functions.
function rc_status () (VOID=1;)
function rc_exit () (exit;)
function rc_failed () (VOID=1;)
fi
function get_pid {
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep -v grep | tail -1 | awk '{ print $2 }'`
echo $TENTACLE_PID
}
# Pandora server settings
PANDORA_SERVER_PATH="/var/spool/pandora/data_in"
# Tentacle server settings
TENTACLE_DAEMON="tentacle_server"
TENTACLE_PATH="/usr/bin"
TENTACLE_USER="pandora"
TENTACLE_ADDR="0.0.0.0"
TENTACLE_PORT="41121"
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5"
# Set umask to 0002, because group MUST have access to write files to
# use remote file management on Pandora FMS Enterprise.
umask 0007
# Main script
TENTACLE_OPTS="-a $TENTACLE_ADDR -p $TENTACLE_PORT -s $PANDORA_SERVER_PATH $TENTACLE_EXT_OPTS -d"
# Fix TENTACLE_PATH
case "$TENTACLE_PATH" in
*\/)
;;
*)
TENTACLE_PATH="${TENTACLE_PATH}/"
;;
esac
if [ ! -f "${TENTACLE_PATH}$TENTACLE_DAEMON" ]; then
echo "Tentacle server not found in ${TENTACLE_PATH}$TENTACLE_DAEMON."
rc_failed 1
rc_exit
fi
case "$1" in
start)
TENTACLE_PID=`get_pid`
if [ ! -z "$TENTACLE_PID" ]; then
echo "Tentacle server is already running with PID $TENTACLE_PID."
rc_failed 2
rc_exit
fi
sudo -u $TENTACLE_USER ${TENTACLE_PATH}$TENTACLE_DAEMON $TENTACLE_OPTS
sleep 1
TENTACLE_PID=`get_pid`
if [ ! -z "$TENTACLE_PID" ]; then
echo "Tentacle server is now running with PID $TENTACLE_PID."
rc_status -v
else
echo "Tentacle server could not be started."
rc_status -v
fi
;;
stop)
TENTACLE_PID=`get_pid`
if [ -z "$TENTACLE_PID" ]; then
echo "Tentacle server does not seem to be running."
rc_failed 2
else
kill $TENTACLE_PID
sleep 1
TENTACLE_PID=`get_pid`
if [ ! -z "$TENTACLE_PID" ]; then
echo "Tentacle server could not be stopped."
rc_status -s
fi
echo "Tentacle server stopped."
rc_status -v
fi
;;
force-reload|restart)
$0 stop
sleep 1
$0 start
rc_status
;;
status)
TENTACLE_PID=`get_pid`
if [ -z "$TENTACLE_PID" ]; then
echo "Tentacle server is not running."
rc_status
else
echo "Tentacle server is running with PID $TENTACLE_PID."
rc_status
fi
;;
*)
echo "Usage: $0 {start | stop | restart | status}"
exit 1
;;
esac
rc_exit