[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

19991019: epager vs. ldm running



Tom,

I actually do the opposite (LDM not running) because I already
get a couple of hundred emails a day...I run this every 10 minutes
and if sucessive failures occur, it restarts the ldm. It emails me
on failures in the mean time.

0,10,20,30,40,50 * * * * /usr/local/ldm/scripts/ldm_isrunning_check.csh

----------------------< ldm_isrunning_check.csh >----------------------

#!/bin/csh -f
#
# this script will attempt to ping your ldm host. On failure, it will
# email you with a warning, and create a /tmp/.ldm_check file on disk
# with the number of failues. On the third sucessive failure (typically
# 30 minutes if run every 10 minutes), the ldm will be restarted.
#
# If ldmping suceeds in the meantime, the /tmp/.ldm_check file is removed
# so that the count is reset. The 30 minute wait is better than
# immediately trying to restart because the LDM can be temporarily
# busy, or someone might have the LDM down temporarily. 30 minutes is
# usually acceptable to regain back data from the upstream's queue.
# Edit the HOST name and mailx path/recipient below.
#
setenv PATH ${PATH}:/usr/local/ldm/bin
set HOST=flip.unidata.ucar.edu

ldmping -h $HOST
set PING=$status

# could also use this...but rpcinfo -t not universal
#ldmadmin isrunning
#set RUN=$status

if($PING == 0) then
   if(-e /tmp/.ldm_check) rm -f /tmp/.ldm_check
   exit 0
endif
  

# edit path for mailx, and email recipient
echo "something wrong with ldm on ${HOST}" | \
   /usr/sbin/mailx -s "help ldm" address@hidden

if(! -e /tmp/.ldm_check) then
   set COUNT=0
else
   set COUNT=`tail -1 /tmp/.ldm_check`
endif

rm -f /tmp/.ldm_check

@ COUNT = $COUNT + 1

if($COUNT < 3) then
   echo $COUNT >! /tmp/.ldm_check
   exit 0
endif

set DATE=`date -u`

# again edit mailx and email recipient
echo "attempting to restart ldm on ${HOST}" | \
   /usr/sbin/mailx -s "restart ldm $DATE" chiz@unidata
if(-e /usr/local/ldm/core) rm /usr/local/ldm/core
ldmadmin stop
sleep 10
ldmadmin delqueue
sleep 10
ldmadmin mkqueue
sleep 60
ldmadmin start




-------------------------------------------------------------------------------
Steve Chiswell
Unidata User Support







On Tue, 19 Oct 1999, Tom Priddy wrote:

> From:  Tom Priddy
> 
> I recently acquire an alfa-pager and want to setup ldm status messages
> to the pager to minimize downstime.  Is there an ldm command that
> I could put in the crontab to receive ldm status messages every
> couple of hours?  Like "LDM Running!"/ktp
> 
> --
> ============================================================
> Tom Priddy                                address@hidden
> Extension Ag. Meteorologist          ph:  606-257-3000ext245
> Ag. Weather Center                  fax:  606-257-5671
> 243 Ag. Engineering Bldg
> Dept. of Biosystems and Ag. Engr.
> University of Kentucky
> Lexington, KY 40546-0276
> HOMEPAGE   http://wwwagwx.ca.uky.edu
> ============================================================
> 
> 
>