pandorafms/pandora_agents/aix/pandora_agent_daemon

63 lines
1.6 KiB
Plaintext
Raw Normal View History

#!/usr/bin/ksh
# Pandora FMS AIX Agent, startup script
# Copyright (c) 2006-2009 Artica ST, <info@artica.es>
# v1.3.1 Build 091104
# http://www.pandorafms.com
# DONT USE WITH OPENSSH
# DOESNT WORK WHEN MAKES A CALL THAT USE @ CHARACTER
# USE DIRECTLY PANDORA AGENT SCRIPT
# for example: pandora_agent /usr/share/pandora_agent/ &
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/usr/share/pandora_agent/
DAEMON=pandora_agent
PIDFILE=/var/locks/pandora_agent.pid
if [ ! -f $PANDORA_PATH/$DAEMON ]
then
echo "Pandora Agent not found at $PANDORA_PATH/$DAEMON, please check setup"
exit
fi
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "Pandora Agent is currently running on this machine. Aborting now..."
exit
fi
2007-06-12 Manuel Arostegui <marostegui@artica.es> * linux/contrib/pandora_agent_installer: Changed a PATH to adapt the script to the 1.3 version. * linux/contrib/pandora_agent_daemon: Added nohup. * linux/pandora_agent: Added features like: Maximum and Minimum hours where the agent can run between. Delayed startup for the agent. Added NICE option to protect CPU. Added "local" as a new transfer mode. * linux/pandora_agent.conf: Changed in order to adapt it to the new features of the agent. * aix/pandora_agent_installer: Added to repository: Pandora Agent Installer for AIX Systems. * aix/pandora_agent_daemon: Added nohup and fixed a small bug related with an "exit" in the beggining of the script. * aix/pandora_agent.conf: Changed in order to adapt it to the new features of the agent. * aix/pandora_agent.sh: Added features like: Maximum and Minimum hours where the agent can run between. Delayed startup for the agent. Added NICE option to protect CPU. Added "ftp" and "local" as a new transfer mode. Added the chance of choosing the remote ssh port to use. * win32/bin/pandora_agent.conf: Changed version number. * solaris/pandora_agent_installer: Added to repository: Pandora Agent Installer for Solaris Systems. * solaris/pandora_agent_daemon: Added nohup. * solaris/pandora_agent.conf: Changed in order to adapt it to the new features of the agent. * solaris/pandora_agent.sh: Added the banner in the start up. Added features like: Maximum and Minimum hours where the agent can run between. Delayed startup for the agent. Added NICE option to protect CPU. Added "ftp" and "local" as a new transfer mode. Added the chance of choosing the remote ssh port to use. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@503 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-06-12 11:32:54 +02:00
nohup $PANDORA_PATH/$DAEMON $PANDORA_PATH >> $PANDORA_PATH/pandora.log & MYPID=$!
echo $MYPID > $PIDFILE
#MYPID=`ps -Alf | grep $DAEMON | grep -v grep | awk '{ print $4 }' | tail -1`
echo $MYPID > $PIDFILE
echo "Pandora Agent is now running with PID $MYPID"
;;
stop)
if [ -f $PIDFILE ]
then
echo "Stopping Pandora Agent."
PID_2=`cat $PIDFILE`
if [ ! -z "`ps -f -p $PID_2 | grep -v grep | grep 'pandora_agent'`" ]
then
kill -9 `cat $PIDFILE`
fi
rm -f $PIDFILE
else
echo "Pandora Agent is not running, cannot stop it. Aborting now..."
fi
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/pandora_agent {start|stop|restart|force-reload}"
exit 1
esac