#!/bin/sh # #$Header: ##****************************************************************************** ## Startup script for the LogTrend Complex Alarms ## Project : LogTrend 1.0.0.0 - Atrid Systemes ## Author : Sylvain Lhullier s.lhullier@atrid.fr (05.03.2001) # chkconfig: 345 85 15 # description: LogTrend is a supervision system # processname: ComplexAlarm # pidfile: /var/run/ComplexAlarm.pid ##****************************************************************************** #$Log: deb.ComplexAlarm,v $ #Revision 1.2 2001/09/27 15:37:47 lsimonneau #*** empty log message *** # #Revision 1.1 2001/07/02 16:35:44 lsimonneau #Ajout des fichiers init.d # # PATH=/sbin/:$PATH ALARM_PATH=/etc/LogTrend/ComplexAlarm status() { # Test syntax. if [ $# = 0 ] ; then echo "Usage: status {program}" return 1 fi # First try "pidof" pid=`pidof -o $$ -o $PPID -o %PPID -x $1` if [ "$pid" != "" ] ; then echo "$1 (pid $pid) is running..." return 0 fi # Next try "/var/run/*.pid" files if [ -f /var/run/$1.pid ] ; then pid=`head -1 /var/run/$1.pid` if [ "$pid" != "" ] ; then echo "$1 dead but pid file exists" return 1 fi fi # See if /var/lock/subsys/$1 exists if [ -f /var/lock/subsys/$1 ]; then echo "$1 dead but subsys locked" return 2 fi echo "$1 is stopped" return 3 } PIDFILE=/var/run/ComplexAlarm.pid # See how we were called. case "$1" in start) echo -n "Starting LogTrend ComplexAlarm" if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name ComplexAlarm then echo " already running." exit fi /sbin/start-stop-daemon --start --quiet \ --exec /usr/lib/perl5/LogTrend/ComplexAlarm/ComplexAlarm -- -d $CONF_FILE echo "." ;; stop) echo -n "Stopping LogTrend ComplexAlarm" if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name ComplexAlarm then PID=`cat $PIDFILE` start-stop-daemon --stop --quiet --pidfile $PIDFILE --name ComplexAlarm # Now we wait for it to die while kill -0 $PID 2>/dev/null; do sleep 1; done echo "." else echo " not running."; fi rm -f /var/run/ComplexAlarm.pid ;; status) status ComplexAlarm ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0