2006-07-06 19:17:49 +02:00
|
|
|
#!/usr/bin/ksh
|
2009-11-04 19:30:18 +01:00
|
|
|
|
|
|
|
# Pandora FMS AIX Agent, startup script
|
|
|
|
# Copyright (c) 2006-2009 Artica ST, <info@artica.es>
|
|
|
|
# v1.3.1 Build 091104
|
|
|
|
# http://www.pandorafms.com
|
2006-07-06 19:17:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
# DONT USE WITH OPENSSH
|
|
|
|
# DOESNT WORK WHEN MAKES A CALL THAT USE @ CHARACTER
|
|
|
|
# USE DIRECTLY PANDORA AGENT SCRIPT
|
|
|
|
|
2007-06-14 16:26:26 +02:00
|
|
|
# for example: pandora_agent /usr/share/pandora_agent/ &
|
2006-07-06 19:17:49 +02:00
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
2007-04-11 Manuel Arostegui <marostegui@artica.es>
* pandora_agents/linux/pandora_agent.conf, pandora_agents.spec: Changed
PATHS to adapt them to the upcoming 1.3 release.
* pandora_agents/bsd-ipso/pandora_agent_daemon, pandora_agent.conf,
pandora_agent.sh: Changed PATHS to adapt them to
the upcoming 1.3 release.
* pandora_agents/aix/pandora_agent_daemon, pandora_agent.conf,
pandora_agent.sh: Changed PATHS to adapt them
to the upcoming 1.3 release.
* pandora_agents/hp-ux/pandora_agent_daemon, pandora_agent.conf,
pandora_agent.sh: Changed PATHS to adapt them
to the upcoming 1.3 release.
* pandora_agents/win32/bin/pandora_agent.conf: Changed PATHS to
adapt them to the upcoming 1.3 release.
* pandora_agents/meta_agent/pandora_agent_sim.sh, pandora_agent_daemon,
pandora_agent_1.conf, pandora_agent_2.conf, pandora_agent_3.conf,
pandora_agent_4.conf, pandora_agent_5.conf: Changed PATHS
to adapt them to the upcoming 1.3 release.
* pandora_agents/solaris/pandora_agent_daemon, pandora_agent.conf,
pandora_agent.sh: Changed PATHS to adapt them to the upcoming
1.3 release.
* pandora_server/pandora_network, pandora_snmpconsole, pandora_server
pandora_recon: Changed PATHS to adapt them to the
upcoming 1.3 release.
* pandora_server/specs/fedoracore5/pandora_server.spec: Changed
PATHS to adapt them to the upcoming 1.3 release.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@418 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-11 14:52:04 +02:00
|
|
|
PANDORA_PATH=/usr/share/pandora_agent/
|
2007-06-14 16:26:26 +02:00
|
|
|
DAEMON=pandora_agent
|
2006-07-06 19:17:49 +02:00
|
|
|
PIDFILE=/var/locks/pandora_agent.pid
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
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 11:32:54 +02:00
|
|
|
nohup $PANDORA_PATH/$DAEMON $PANDORA_PATH >> $PANDORA_PATH/pandora.log & MYPID=$!
|
2006-03-27 05:37:27 +02:00
|
|
|
echo $MYPID > $PIDFILE
|
2006-07-06 19:17:49 +02:00
|
|
|
#MYPID=`ps -Alf | grep $DAEMON | grep -v grep | awk '{ print $4 }' | tail -1`
|
|
|
|
echo $MYPID > $PIDFILE
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "Pandora Agent is now running with PID $MYPID"
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
if [ -f $PIDFILE ]
|
|
|
|
then
|
2006-07-06 19:17:49 +02:00
|
|
|
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
|
2006-03-27 05:37:27 +02:00
|
|
|
rm -f $PIDFILE
|
|
|
|
else
|
|
|
|
echo "Pandora Agent is not running, cannot stop it. Aborting now..."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
force-reload|restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
*)
|
2009-11-04 19:30:18 +01:00
|
|
|
echo "Usage: /etc/init.d/pandora_agent {start|stop|restart|force-reload}"
|
2006-03-27 05:37:27 +02:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|