NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#!/bin/bash
############################################################################
# File Name : weeklyLoad.sh
# Description : This is the script do the weekly loading of MBIS data.
# cron job don't need any parameter as long as it is run on the weekend.
#
# YYYYMMDD Name Description
# ------------------------------------------------------------------------ #
# 20180126 Yiting Nan Created
############################################################################

#if APP_NAME not found run env file.
source config/MBIS.env

if [ $# -gt 1 ] || [ "${1}" = "?" ];then printf "
Error: Invalid number of parameters
Usage: weeklyLoad.sh [inputDate]
inputDate is optional. It is in YYYYMMDD format. If inputDate is missing, current date will be used.
If specified, the week before inputDate would be loaded.
If inputDate is Saturday or Sunday, it is the current week would be loaded.
Sunday is consider the end of week.
Example: weeklyLoad.sh
Today's date 20180128 (Sunday) would load the week from 20180122 to 20180126
weeklyLoad.sh 20180127
It would load the week from 20180122 to 20180126
weeklyLoad.sh 20180117
It would load the week from 20180108 to 20180112
";exit 1;fi

#If inputDate is missing, current date will be used.
if [ $# -eq 1 ]
then
#11111 check it is in right date format and it is a valid date.
INPUTDATE=$1
else
INPUTDATE=`date +%Y%m%d`
fi

LOG_FILE="${LOG_DIR}/weekly_${INPUTDATE}.log"

echo `date` " Start weekly load on " ${INPUTDATE} >> ${LOG_FILE}

####### Validate input date is a valid business day ######
# Day of the week: Sunday -- Saturday is 0..6
week_of_day=$(date -d ${INPUTDATE} +%w)
shift=(6 7 8 9 10 11 5)

WEEKOFDAY[0]=$(date -d "${INPUTDATE} - ${shift[${week_of_day}]} days " +%Y%m%d)
echo `date` " calculated the week of loading Monday is " ${WEEKOFDAY[0]} >> ${LOG_FILE}
MAX=5
for (( i=0; i<$MAX; ++i ))
do
wd=$(( $i + 1 ))
echo `date`" " $wd " of the week is " ${WEEKOFDAY[$i]} >> ${LOG_FILE}
# rev_num=`sqlplus ${ORA_METADATA_CONNECTION} << EOF
#whenever sqlerror exit 1;
#set pagesize 0
#set feedback off
#set heading off
#select count(*) from MD_HOLIDAY where holiday_category='${HOLIDAY_SCHEDULE}' and holiday_date=to_date('${WEEKOFDAY[$i]}', 'YYYYMMDD');
#exit;
#EOF`
# if [ $rev_num -eq 1 ]
# then
# echo `date` ${WEEKOFDAY[$i]} " is a holiday. Continue on next date " >> ${LOG_FILE}
# else
echo `date` ${WEEKOFDAY[$i]} " is a valid business day, load all four datasets. " >> ${LOG_FILE}
${WORK_DIR}/SingleDataset.sh quotes ${WEEKOFDAY[$i]}
${WORK_DIR}/SingleDataset.sh peer_index ${WEEKOFDAY[$i]}
${WORK_DIR}/SingleDataset.sh curve ${WEEKOFDAY[$i]} DAILY
${WORK_DIR}/SingleDataset.sh curve ${WEEKOFDAY[$i]} HOURLY
# fi
WEEKOFDAY[$wd]=$(date -d "${WEEKOFDAY[0]} + $wd days " +%Y%m%d)
done

echo `date` " Finishing weekly load on " ${INPUTDATE} >> ${LOG_FILE}




     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.