1
0
Files
irix-657m-src/eoe/cmd/sss/evmond/eventmonitor
2022-09-29 17:59:04 +03:00

102 lines
4.2 KiB
Bash
Executable File

#!/sbin/sh
# $Revision: 1.1 $
# ---------------------------------------------------------------------------
# Copyright 1992-1999 Silicon Graphics, Inc.
# All Rights Reserved.
#
# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.
# the contents of this file may not be disclosed to third parties, copied or
# duplicated in any form, in whole or in part, without the prior written
# permission of Silicon Graphics, Inc.
#
# RESTRICTED RIGHTS LEGEND:
# Use, duplication or disclosure by the Government is subject to restrictions
# as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
# and Computer Software clause at DFARS 252.227-7013, and/or in similar or
# successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
# rights reserved under the Copyright Laws of the United States.
# ---------------------------------------------------------------------------
# eventmond will run as a daemon and will startup when the system boots.
# In the case that the SSDB server is not running or the SEM is not running,
# eventmond daemon will buffer events that come from syslogd daemon.
# ---------------------------------------------------------------------------
# EventMonitor daemon 'eventmond' startup script
#
# script name: eventmonitor
# script location: /etc/init.d
# link from script file: /etc/init.d/sysetup
# relationship: /usr/etc/eventmond
# ---------------------------------------------------------------------------
LOCALSIGNATURE="LVA"
DAEMONNAME="/usr/etc/eventmond"
#DAEMONNAME="eventmond"
APPSTARTUPNAME="eventmonitor"
# Check command string
if test ! "$1"
then echo "$APPSTARTUPNAME - Missing command string"
exit 1
fi
# Check daemon file
if ! test -x $DAEMONNAME
then echo "$APPSTARTUPNAME - Can't find daemon binary file - $DAEMONNAME"
exit 1
fi
# Check command string
if test "$1" != "start" -a "$1" != "START" -a "$1" != "stop" -a "$1" != "STOP"
then echo "$APPSTARTUPNAME - Invalid parameter - $1, Please use start or stop"
exit 1
fi
trap 'echo "$APPSTARTUPNAME - Can not interrupt, please wait!"' 1 2 15
# Check "START" command
if test "$1" = "start" -o "$1" = "START"
then $DAEMONNAME -silence -start -p 45 -g on > /dev/null 2>&1 ; RETCODE=$?
if test $RETCODE -eq 0
then echo "$APPSTARTUPNAME - daemon started"
exit $RETCODE
fi
fi
# Check "STOP" command
if test "$1" = "stop" -o "$1" = "STOP"
then $DAEMONNAME -silence -stop > /dev/null 2>&1 ; RETCODE=$?
if test $RETCODE -eq 0
then sleep 1
echo "$APPSTARTUPNAME - daemon stopped"
rm -f /tmp/.eventmond.info.sock > /dev/null ; rm -f /tmp/.eventmond.events.sock > /dev/null
number=0
while true
do rm -f /tmp/.eventmond.$number.tmp > /dev/null ; number=`expr $number + 1`
if test $number -ge 100
then break
fi
done
exit $RETCODE
fi
fi
case $RETCODE in
1) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Invalid parameter(s) or Permission denied";;
2) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - System call fork() error";;
3) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Incorrect system parameter(s)";;
4) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Killed in exec phase";;
5) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Init internal data error";;
6) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Init threads error";;
7) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Can't _daemonize()";;
8) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Already Installed";;
9) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Can't make temp file name";;
10) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Can't open socket";;
11) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Can't bind socket";;
12) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Daemon not started";;
13) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Permission denied";;
14) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Invalid CPU command";;
15) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Invalid FPE command";;
16) echo "$APPSTARTUPNAME - ($RETCODE) daemon can't $1 - Can't set socket option(s)";;
*) echo "$APPSTARTUPNAME - Can't $1 daemon, unknown error code: $RETCODE";;
esac
exit $RETCODE