Shell scripts run Hive SQL

Source: Internet
Author: User

#!/b

START=$(Date+%s);d Atebegin=`Date-D" $" "+%y%m%d"' DateEnd=`Date-D" $" "+%y%m%d"' Sdate=`Date-D"$datebegin-1 days" "+%y%m%d"` while["$datebegin"-le"$dateend" ] DoEcho$datebegin/usr/local/hivebi/bin/hive<<EOF--Hive SQL Like:drop TABLE IF EXISTS yourdb.yourtablename; EOF

datebegin= ' date-d ' $datebegin +1 Day "+%y%m%d"

Sdate= ' date-d ' $sdate +1 Day "+%y%m%d"

 Done END=$ (date +%s); Echo awk ' {print int ($1/3600): "Int ($1%3600/60)": "Int ($1%3600%60)} '

How to use:

chmod +x test. SH . /test. SH 20160505 20160506

Where--is the comment symbol in hive SQL.

Shell scripts run Hive SQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.