#!/bin/perl
use Time::Local;
my $month=shift;
my $day=shift;
my $year=shift;
my $hour=shift;
my $min=shift;
my $sec=shift;
my $var=shift;
if ( "\u$var" =~ /PM/ )
{ $hour=$hour+12; }
my $time = timelocal(sec,min,hour,$day,$month-1,$year-1900);
my $time1 = timelocal(localtime());
my $days = ( $time1-$time ) / 60;
printf("%f", $days);
thanks a lot for the reply. is cal_days a seperate file. how do i invoke it and where do i implement my logic for checking if the current time is greater than 20 min or not. my shell script knowledge is very poor.
is cal_days a file with .pl extension. where should i save that file. how will i invoke it as a function in my current file. pls elaborate on this. i appreciate your help. thanks again.
#!/bin/perl
use Time::Local;
my $day=shift;
my $month=shift;
my $year=shift;
my $hour=shift;
my $min=shift;
my $sec=shift;
my $var=shift;
if ( "\u$var" =~ /PM/ )
{ $hour=$hour+12; }
my $time = timelocal(sec,min,hour,$day,$month-1,$year-1900);
my $time1 = timelocal(localtime());
my $days = ( $time1-$time ) / 60;
printf("%f", $days);
I think you have changed the format of the variable check_ts.
cur_time=`sqlplus -s batch_user/batch_user@$SIEBEL_DB_ORACLESID << EOF0
set heading off
SET FEEDBACK OFF
SET PAGESIZE 0
SET LINESIZE 900
select created from FusionHC_Job_State
where created = (select max(created) from FusionHC_Job_State);
EOF0`
Then i do this in original script
tm=$(cal_days `echo $cur_time | sed -e "s/\// /g" -e "s/:/ /g"`)
if [[ $tm -gt 20 ]]
then
exit
fi