Hi Gurus,
I am working one below script. I am stuck at the else condition.
#!/bin/ksh
while :
do
cur_date=`date |cut -d"," -f 1`
cur_time=`date +"%H%M"
if [ "$cur_date" != "Saturday" ]||[ "$cur_date" != "Sunday" ]; then
if [ ! -f $FIRST_FILE ] && [ $cur_time -ge 2200 ]; then
echo "File " $FIRST_FILE " doesn't exist!"
exit 30
elif
[ ! -f $FIRST_FILE ] && [ $cur_time -le 2200 ]; then
"here I want to the script jump to sleep directly without execute the below loop."
else
fyr=`ls -e $FIRST_FILE |awk '{print $9}'`
echo $fyr
mth=`ls -e $FIRST_FILE |awk '{print $6}'`
dy=`ls -e $FIRST_FILE |awk '{printf "%0.2d\n", $7}'`
time=`ls -e $FIRST_FILE |awk '{print $8}'`
echo "arr, start_file, $file, $fyr, $mth, $dy, $time" >> "$SRCDIR"/arr_code_list
fi
fi
while IFS="," read code folder file suffix
do
filedir="$SRCDIR"/"$folder"
inputfile="$filedir"/"$file"
suffix=$suffix
if [ -f ${inputfile}[0-9]*${suffix} ] ; then
ofile=`ls -1tr $inputfile*|head -1`
mth=`ls -e $ofile |awk '{print $6}'`
dy=`ls -e $ofile |awk '{printf "%0.2d\n", $7}'`
time=`ls -e $ofile |awk '{print $8}'`
yr=`ls -e $ofile|awk '{print $9}'`
echo "$code, $file, $yr, $mth, $dy, $time" >> "$SRCDIR"/arr_code_list
else
echo "$code, $folder, $file, NOT FOUND" >>"$TGTDIR"/not_arrival_list
fi
done < $FEED_LIST
sleep 900
done
the script checks file every 15 minutes
the requirement as like below
for weekday, then check $FIRST_FILE first,
if $FIRST_FILE arrived before 10:00Pm, then checking rest file,
if $FIRST_FILE not arrive before 10:00pm then sleep 15 minutes then start loopping again.
if $FIRST_FILE not found after 10:00pm, script exit with error code.
for weekend only checking other files without checking $FIRST_FILE;
in above script, I don't know how to jump to sleep if the $FIRST_FILE not arrival but time is early then 10:00 PM. (highlited in red)
Anybody can give me some idea.
Thanks in advance