shell 脚本运行 hive sql
2016-05-24 18:06
387 查看
#!/b
datebegin=`date -d "$datebegin +1 day " +%Y%m%d`
sdate=`date -d "$sdate +1 day " +%Y%m%d`
使用方法:
其中 -- 是 hive sql 中的注释符号.
START=$(date +%s); datebegin=`date -d "$1" "+%Y%m%d"` dateend=`date -d "$2" "+%Y%m%d"` sdate=`date -d "$datebegin -1 days" "+%Y%m%d"` while [ "$datebegin" -le "$dateend" ] do echo $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 $((END-START)) | awk '{print int($1/3600)":"int($1%3600/60)":"int($1%3600%60)}'
使用方法:
chmod +x test.sh ./test.sh 20160505 20160506
其中 -- 是 hive sql 中的注释符号.
相关文章推荐
- shell默认参数
- shell判断、循环、控制语句与函数应用
- Shell脚本与vi编辑器:vi启动与退出、工作模式、命令大全
- 今天在写powershell脚本中犯的两个错误
- shell常用命令
- shell常用符号和逻辑判断
- 希尔排序(Shell Sort)
- shell自动发布脚本
- shell 中正则表达式替换赋值 测试示例
- 发现磁盘的shell
- 各种排序算法集锦
- phpwind 利用哈希长度扩展攻击进行getshell
- shell中的大括号和小括号 转自“红黑联盟”
- Hbase shell 常用命令
- Genymotion shell的使用以及实例
- Linux Shell系列教程之(二)第一个Shell脚本
- Linux Shell系列教程之(一)Shell简介
- shell脚本中的重定向符号
- 教你如何在linux上装逼,shell中颜色的设置
- shell ${} 用法