help

From: Nelson Kawumi <kawumin_at_mtn.co.ug>
Date: Wed, 31 Jul 2002 16:46:02 +0300

>I'm running a script that does continuous ftp of files to a given ftp
>server. When started manually, it runs fine. When started using CAA, it
>gives the following error,
>
>
>
>EVM alert [sauga01.mtn.co.ug]: CAAD[524900]: `streamserve` on `sauga01` went
>OFFLINE unexpectedly
>
>in the CAA script I run the following to stop the application
>
>kill `ps -e | grep streamserve.sh | grep -v "grep" | cut -d " " -f 1`
>
>I need help on this error
>
>Attached are my profile and script
>
>Profile
>
>NAME=streamserve
>
>TYPE=application
>
>ACTION_SCRIPT=streamserve.scr
>
>ACTIVE_PLACEMENT=0
>
>AUTO_START=1
>
>CHECK_INTERVAL=60
>
>DESCRIPTION=streamserve
>
>FAILOVER_DELAY=0
>
>FAILURE_INTERVAL=40
>
>FAILURE_THRESHOLD=3
>
>HOSTING_MEMBERS=sauga02 sauga01
>
>OPTIONAL_RESOURCES=
>
>PLACEMENT=restricted
>
>REQUIRED_RESOURCES=
>
>RESTART_ATTEMPTS=1
>
>SCRIPT_TIMEOUT=60
>
>Script
>
>
>
>SERVICE_NAME="streamserve"
>
>PROBE_PROCS="/usr/scripts/streamserve.sh"
>
>START_APPCMD="/usr/scripts/streamserve.sh"
>
>STOP_APPCMD="/usr/scripts/streamservestop.sh"
>
>APPDIR="/usr/scripts"
>
>export SERVICE_NAME START_APPCMD START_APPCMD2
>
>export APPDIR PROBE_PROCS STOP_APPCMD STOP_APPCMD2
>
>DEBUG_PRIORITY=100
>
>INFO_PRIORITY=200
>
>ERROR_PRIORITY=500
>
>SCRIPT=$0
>
>ACTION=$1 # Action (start, stop or check)
>
>EVMPOST="/usr/bin/evmpost" # EVM command to post events
>
>DEBUG=0
>
>if [[ "$CAA_SCRIPT_DEBUG" != "" ]]; then
>
>DEBUG=1
>
>EVMPOST="/usr/bin/evmpost -r | /usr/bin/evmshow -d"
>
>fi
>
>export EVMPOST ACTION SCRIPT
>
>etpid () {
>
>if [ -n "$1" ]; then
>
>GETMYPID=$1
>
>shift
>
>/bin/ps -e -o pid,command $* | while read mypid command args
>
>do
>
>if [ "$command" = "$GETMYPID" ]; then
>
>echo "$mypid"
>
>fi
>
>done
>
>fi
>
>
>
>zapdaemon () {
>
>typeset ret=0
>
>for i in ${1}
>
>do
>
>checkdaemon ${i}
>
>if [ $? -ne 0 ]; then
>
>kill `getpid ${i}`
>
>checkdaemon ${i}
>
>if [ $? -ne 0 ]; then
>
>kill -9 `getpid ${i}`
>
>checkdaemon ${i}
>
>if [ $? -ne 0 ]; then
>
>postevent $ERROR_PRIORITY "${i}: stuck - could not kill -KIL
>
>L"
>
>ret=1
>
>else
>
>postevent $ERROR_PRIORITY "${i}: killed with -KILL"
>
>fi
>
>else
>
>postevent "" "${i}: killed"
>
>fi
>
>fi
>
>done
>
>return $ret
>
>
>
>probeapp () {
>
>checkdaemon $1
>
>if [ $? -ne 0 ]; then
>
>postevent $DEBUG_PRIORITY "$1 check OK"
>
>return 0
>
>else
>
>postevent $DEBUG_PRIORITY "$1 check failed"
>
>return 1
>
>fi
>
>
>
>case $1 in
>
>'start')
>
>postevent $DEBUG_PRIORITY "trying to start"
>
>cd $APPDIR
>
>if [ "$START_APPCMD" != "" ]; then
>
>$START_APPCMD &
>
>if [ $? -ne 0 ]; then
>
>postevent $ERROR_PRIORITY "start: $out"
>
>exit 1
>
>fi
>
>fi
>
>
>
>'stop')
>
>postevent $DEBUG_PRIORITY "trying to stop"
>
>cd $APPDIR
>
>if [ "$STOP_APPCMD" != "" ]; then
>
>$STOP_APPCMD &
>
>if [ $? -ne 0 ]; then
>
>postevent $ERROR_PRIORITY "stop: $out"
>
>exit 1
>
>fi
>
>fi
>
>if [ $STOP_APPCMD2 != "" ]; then
>
>$STOP_APPCMD2 &
>
>if [ $? -ne 0 ]; then
>
>postevent $ERROR_PRIORITY "stop 2: $out"
>
>exit 1
>
>fi
>
>fi
>
>if [ "$START_APPCMD2" != "" ]; then
>
>$START_APPCMD2 &
>
>if [ $? -ne 0 ]; then
>
>postevent $ERROR_PRIORITY "start 2: $out"
>
>exit 1
>
>fi
>
>fi
>
>;;
>
>for i in ${PROBE_PROCS}; do
>
>zapdaemon ${i}
>
>done
>
>;;
>
>'check')
>
>for i in ${PROBE_PROCS}; do
>
>postevent $DEBUG_PRIORITY "trying to check $i"
>
>probeapp $i
>
>if [ $? -ne 0 ]; then
>
>postevent "" "check failed for $i"
>
>exit 1
>
>fi
>
>done
>
>;;
>
>*)
>
>postevent $ERROR_PRIORITY "usage: $0 {start|stop|check}"
>
>exit 1
>
>;;
>
>esac
>
>postevent "" success
>
>exit 0
>
>
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
><HTML>
><HEAD>
><TITLE></TITLE>
></HEAD>
><BODY>
><!-- Converted from text/plain format -->
>
><P><FONT SIZE=2>I'm running a script that does continuous ftp of files to a
given ftp<BR>
>server. When started manually, it runs fine. When started using CAA, it<BR>
>gives the following error,<BR>
><BR>
><BR>
><BR>
>EVM alert [sauga01.mtn.co.ug]: CAAD[524900]: `streamserve` on `sauga01`
went<BR>
>OFFLINE unexpectedly<BR>
><BR>
>in the CAA script I run the following to stop the application<BR>
><BR>
>kill `ps -e | grep streamserve.sh | grep -v &quot;grep&quot; | cut -d &quot;
&quot; -f 1`<BR>
><BR>
>I need help on this error<BR>
><BR>
>Attached are my profile and script<BR>
><BR>
>Profile<BR>
><BR>
>NAME=streamserve<BR>
><BR>
>TYPE=application<BR>
><BR>
>ACTION_SCRIPT=streamserve.scr<BR>
><BR>
>ACTIVE_PLACEMENT=0<BR>
><BR>
>AUTO_START=1<BR>
><BR>
>CHECK_INTERVAL=60<BR>
><BR>
>DESCRIPTION=streamserve<BR>
><BR>
>FAILOVER_DELAY=0<BR>
><BR>
>FAILURE_INTERVAL=40<BR>
><BR>
>FAILURE_THRESHOLD=3<BR>
><BR>
>HOSTING_MEMBERS=sauga02 sauga01<BR>
><BR>
>OPTIONAL_RESOURCES=<BR>
><BR>
>PLACEMENT=restricted<BR>
><BR>
>REQUIRED_RESOURCES=<BR>
><BR>
>RESTART_ATTEMPTS=1<BR>
><BR>
>SCRIPT_TIMEOUT=60<BR>
><BR>
>Script<BR>
><BR>
><BR>
><BR>
>SERVICE_NAME=&quot;streamserve&quot;<BR>
><BR>
>PROBE_PROCS=&quot;/usr/scripts/streamserve.sh&quot;<BR>
><BR>
>START_APPCMD=&quot;/usr/scripts/streamserve.sh&quot;<BR>
><BR>
>STOP_APPCMD=&quot;/usr/scripts/streamservestop.sh&quot;<BR>
><BR>
>APPDIR=&quot;/usr/scripts&quot;<BR>
><BR>
>export SERVICE_NAME START_APPCMD START_APPCMD2<BR>
><BR>
>export APPDIR PROBE_PROCS STOP_APPCMD STOP_APPCMD2<BR>
><BR>
>DEBUG_PRIORITY=100<BR>
><BR>
>INFO_PRIORITY=200<BR>
><BR>
>ERROR_PRIORITY=500<BR>
><BR>
>SCRIPT=$0<BR>
><BR>
>ACTION=$1 # Action (start, stop or check)<BR>
><BR>
>EVMPOST=&quot;/usr/bin/evmpost&quot; # EVM command to post events<BR>
><BR>
>DEBUG=0<BR>
><BR>
>if [[ &quot;$CAA_SCRIPT_DEBUG&quot; != &quot;&quot; ]]; then<BR>
><BR>
>DEBUG=1<BR>
><BR>
>EVMPOST=&quot;/usr/bin/evmpost -r | /usr/bin/evmshow -d&quot;<BR>
><BR>
>fi<BR>
><BR>
>export EVMPOST ACTION SCRIPT<BR>
><BR>
>etpid () {<BR>
><BR>
>if [ -n &quot;$1&quot; ]; then<BR>
><BR>
>GETMYPID=$1<BR>
><BR>
>shift<BR>
><BR>
>/bin/ps -e -o pid,command $* | while read mypid command args<BR>
><BR>
>do<BR>
><BR>
>if [ &quot;$command&quot; = &quot;$GETMYPID&quot; ]; then<BR>
><BR>
>echo &quot;$mypid&quot;<BR>
><BR>
>fi<BR>
><BR>
>done<BR>
><BR>
>fi<BR>
><BR>
>}<BR>
><BR>
>zapdaemon () {<BR>
><BR>
>typeset ret=0<BR>
><BR>
>for i in ${1}<BR>
><BR>
>do<BR>
><BR>
>checkdaemon ${i}<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>kill `getpid ${i}`<BR>
><BR>
>checkdaemon ${i}<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>kill -9 `getpid ${i}`<BR>
><BR>
>checkdaemon ${i}<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;${i}: stuck - could not kill -KIL<BR>
><BR>
>L&quot;<BR>
><BR>
>ret=1<BR>
><BR>
>else<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;${i}: killed with -KILL&quot;<BR>
><BR>
>fi<BR>
><BR>
>else<BR>
><BR>
>postevent &quot;&quot; &quot;${i}: killed&quot;<BR>
><BR>
>fi<BR>
><BR>
>fi<BR>
><BR>
>done<BR>
><BR>
>return $ret<BR>
><BR>
>}<BR>
><BR>
>probeapp () {<BR>
><BR>
>checkdaemon $1<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $DEBUG_PRIORITY &quot;$1 check OK&quot;<BR>
><BR>
>return 0<BR>
><BR>
>else<BR>
><BR>
>postevent $DEBUG_PRIORITY &quot;$1 check failed&quot;<BR>
><BR>
>return 1<BR>
><BR>
>fi<BR>
><BR>
>}<BR>
><BR>
>case $1 in<BR>
><BR>
>'start')<BR>
><BR>
>postevent $DEBUG_PRIORITY &quot;trying to start&quot;<BR>
><BR>
>cd $APPDIR<BR>
><BR>
>if [ &quot;$START_APPCMD&quot; != &quot;&quot; ]; then<BR>
><BR>
>$START_APPCMD &amp;<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;start: $out&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>fi<BR>
><BR>
>fi<BR>
><BR>
><BR>
><BR>
>'stop')<BR>
><BR>
>postevent $DEBUG_PRIORITY &quot;trying to stop&quot;<BR>
><BR>
>cd $APPDIR<BR>
><BR>
>if [ &quot;$STOP_APPCMD&quot; != &quot;&quot; ]; then<BR>
><BR>
>$STOP_APPCMD &amp;<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;stop: $out&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>fi<BR>
><BR>
>fi<BR>
><BR>
>if [ $STOP_APPCMD2 != &quot;&quot; ]; then<BR>
><BR>
>$STOP_APPCMD2 &amp;<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;stop 2: $out&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>fi<BR>
><BR>
>fi<BR>
><BR>
>if [ &quot;$START_APPCMD2&quot; != &quot;&quot; ]; then<BR>
><BR>
>$START_APPCMD2 &amp;<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;start 2: $out&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>fi<BR>
><BR>
>fi<BR>
><BR>
>;;<BR>
><BR>
>for i in ${PROBE_PROCS}; do<BR>
><BR>
>zapdaemon ${i}<BR>
><BR>
>done<BR>
><BR>
>;;<BR>
><BR>
>'check')<BR>
><BR>
>for i in ${PROBE_PROCS}; do<BR>
><BR>
>postevent $DEBUG_PRIORITY &quot;trying to check $i&quot;<BR>
><BR>
>probeapp $i<BR>
><BR>
>if [ $? -ne 0 ]; then<BR>
><BR>
>postevent &quot;&quot; &quot;check failed for $i&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>fi<BR>
><BR>
>done<BR>
><BR>
>;;<BR>
><BR>
>*)<BR>
><BR>
>postevent $ERROR_PRIORITY &quot;usage: $0 {start|stop|check}&quot;<BR>
><BR>
>exit 1<BR>
><BR>
>;;<BR>
><BR>
>esac<BR>
><BR>
>postevent &quot;&quot; success<BR>
><BR>
>exit 0<BR>
><BR>
><BR>
></FONT>
></P>
>
></BODY>
></HTML>
Received on Wed Jul 31 2002 - 13:44:56 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT