pandorafms/pandora_agents/bsd-ipso/pandora_agent_daemon

42 lines
959 B
Tcsh
Executable File

#!/bin/csh
# Script de arranque de Agente Pandora
# Sancho Lerena, <slerena@gmail.com>
# Version para IPSO/BSD (csh)
# version 1.1
set PANDORA_PATH=/opt/pandora_agent
set DAEMON=pandora_agent.sh
set PIDFILE=/var/run/pandora.pid
test -x $PANDORA_PATH/$DAEMON || exit
switch ($1)
case start:
if ( -e $PIDFILE ) then
echo "Pandora Agent is currently running on this machine. Aborting now..."
exit
else
nice -10 $PANDORA_PATH/$DAEMON $PANDORA_PATH & set MYPID=$!
echo $MYPID > /var/run/pandora.pid
echo "Pandora Agent is now running with PID $MYPID"
exit
endif
breaksw
case stop:
if ( -f $PIDFILE ) then
echo "Stopping Pandora Agent."
kill -9 `cat $PIDFILE`
rm $PIDFILE
else
echo "Pandora Agent is not running, cannot stop it. Aborting now..."
endif
breaksw
case restart:
$0 stop
$0 start
breaksw
default:
echo "Uso: ./pandora_agent {start|stop|restart|force-reload}"
breaksw
endsw