count=`expr $a - $Time`
if [ $count -gt 30 ]
then
echo "it is not processing data"
else
echo "it is processing data"
fi
--------------------------------------------------------------
so here if the delay b/w the time is More than 30 minutes,so it means it is not processing data
plz help me in this
Here is a ksh function which converts a time to seconds passed since midnight. From there on it is simply a matter of integer arithmetic.
# ------------------------------------------------------------------------------
# f_ConvertTime converts timestrings to seconds since MN
# ------------------------------------------------------------------------------
# Author.....: Wolf Machowitsch
# last update: 2005 05 15 by: Wolf Machowitsch
# ------------------------------------------------------------------------------
# Revision Log:
# - 0.99 2005 05 15 Original Creation
# base functionality, correction of incomplete
# timestrings like ":15" or "14"
#
# - 1.00 2007 11 20 Production release
# it was possible to pass nonsense data without
# f_ConvertTime() returning ERRLVL 1. This is
# now fixed. "f_ConvertTime aksj:00" will give
# back 1 as return value.
#
# ------------------------------------------------------------------------------
# Usage:
# f_ConvertTime <char> timestring -> <int> seconds
#
# Example: iSecondsSinceMidnight=$(f_ConvertTime "10:00:00")
# print - $iSecondsSinceMidnight # yields "36000"
#
# Prerequisites:
#
# ------------------------------------------------------------------------------
# Documentation:
# f_ConvertTime() gets a timestring in $1 and prints the number of
# seconds elapsed since midnight up to this time to <stdout>.
# "Timestring" is any string of up to 3 digit groups delimited by
# a non-digit separator. Digit groups amounting to "0" can be omitted
# as can trailing separators, therefore "10:00:00", "10:00" and "10"
# are treated the same, as well as "10-00.00", etc..
#
# "00:10:01" can also be written ":00:01" and "10::10" and "10:00:10"
# will both result in 36010.
#
# Parameters: char Timestring
# returns: 0 = no error
# 1 = parameter error, minutes > 60, etc.
# >1 = miscellaneous error
# Result is printed to <stdout>
#
# ------------------------------------------------------------------------------
# known bugs:
#
# none
# ------------------------------------------------------------------------------
# ......................(C) 2005 Wolf Machowitsch ..............................
# ------------------------------------------------------------------------------
f_ConvertTime ()
{
typeset -i iRetVal=0
typeset chTime="$1"
typeset -i iHours=0
typeset -i iMinutes=0
typeset -i iSeconds=0
typeset -i iTimeSecs=0
$chFullDebug
# correct timestring
chTime="$(print - "$chTime" | sed 's/[^0-9]/:/g')" # 14.15.00 -> 14:15:00
chTime="00${chTime}:00:00" # 14 -> 14:00:00
# :15 -> 00:15:00:00
if [ "$(print - $chTime | cut -d':' -f1)" != "" ] ; then
iHours=$(print - $chTime | cut -d':' -f1)
if [ $iHours -lt 0 -o $iHours -gt 23 ] ; then
iRetVal=1
fi
else
iRetVal=1
fi
if [ "$(print - $chTime | cut -d':' -f2)" != "" ] ; then
iMinutes=$(print - $chTime | cut -d':' -f2)
if [ $iMinutes -lt 0 -o $iMinutes -gt 59 ] ; then
iRetVal=1
fi
else
iRetVal=1
fi
if [ "$(print - $chTime | cut -d':' -f3)" != "" ] ; then
iSeconds=$(print - $chTime | cut -d':' -f3)
if [ $iSeconds -lt 0 -o $iSeconds -gt 59 ] ; then
iRetVal=1
fi
else
iRetVal=1
fi
(( iTimeSecs = iSeconds + iMinutes * 60 + iHours * 3600 ))
print - $iTimeSecs
return $iRetVal
}
# --- EOF f_ConvertTime