shell指令碼判斷hive表是否存在
#!/bin/bash
#日誌目錄
#shell判斷表hive表是否存在
#TABLE=庫名.表名
TABLE=dal.dal_mdn_communication_behavior
hive -e"
desc $TABLE;
" 2>&1 | grep 'Table not found'
rtstatus=$?
echo $rtstatus
if [ $rtstatus -ne 0 ]; then
echo "hbase表已存在!"
else
echo "hbase表不存在!"
fi
以上內容,僅作為自己學習使用
相關推薦
shell指令碼判斷hive表是否存在
#!/bin/bash #日誌目錄 #shell判斷表hive表是否存在 #TABLE=庫名.表名 TABLE=dal.dal_mdn_communication_behavior hive -e" desc $TABLE; " 2>&1 | grep
Shell指令碼執行hive語句 | hive以日期建立分割槽表 | linux schedule程式 | sed替換檔案字串 | shell判斷hdfs檔案目錄是否存在
#!/bin/bash source /etc/profile; ################################################## # Author: ouyangyewei # #
Shell指令碼 判斷使用者和使用者組是否已經存在/建立使用者和使用者組
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
一個簡單的shell指令碼--判斷網段主機IP存活情況
在日常工作中,我們運維人員有時也需要配合網路工程師進行測試網路IP的使用情況,此指令碼用於測試使用。 #!/bin/bash # #by skyfans #seq命令用於產生從某個數到另外一個數之間的所有整數。 #分解這個組合:“>/dev/null 2
Shell指令碼執行Hive語句
#!/bin/bash #give the params: name value tablename if [ $# -eq 3 ] then name=$1 value=$2 tablename=$3 echo name=${name} echo value=${value} echo
使用shell指令碼執行hive、sqoop命令
1、test.sh指令碼內容如下: #!/bin/bash #CURR_DATE=`date +"%Y-%m-%d %H:%M:%S"`------>不能使用v_sql="insert into
在Oozie 中排程執行shell、hive 指令碼,以及通過shell指令碼執行hive/sqoop/shell指令碼的方法
最近專案需要用到OOzie工具,可是找了好久,也沒有找到一個完整的、統一的解決和部署方案。經過努力,終於打通了其中的所有環節,解決了各種坑爹的問題。 首先,就專案需求做一個簡單的介紹: 專案需要從mysql中匯入資料到hive進行離線計算後,再導回到mys
shell批量匯出hive表結構
#!/bin/bash rm -rf databases.txt hive -e " show databases; exit ;" > databases #sleep(2) rm -rf
shell定時建立Hive表分割槽
首先看一下hive 的help命令: [[email protected] hive]$ hive -h Missing argument for option: h usage: h
shell指令碼執行hive命令傳值給sql檔案、shell傳參
使用場景,大資料平臺azkaban任務中通過shell指令碼呼叫sql檔案(尤其是呼叫多個sql時),希望可以傳參到sql檔案中 方法:本例以sh呼叫hive命令執行sql為例,道理相同 1、sh 檔案中執行hive -f 命令 將inputdate傳給sql檔案使用
shell指令碼判斷
條件判斷if格式:if 條件;then內容elif 條件;then內容else內容 fi case格式:case 變數引用 inPAT1}內容;;PAT2)內容;;....*)內容;;esac shell配置檔案讀取順序互動式登入:/etc/profile-->/etc/profile.d/.sh-
shell指令碼判斷某個linux程式是否在正常執行,如果不是就啟動他
#! /bin/bash # author qzlink # time 2014-9-19 # program : check program running .. function check(){ count=`ps -ef |grep $1 |grep
Shell指令碼判斷是否是閏年
#! /bin/bash echo -n Input year to judge if it is a leap year: read year let "y1=$year % 4" let "y2=$year % 100" let "y3=$year % 400" if [ ! "$y1" -eq 0 ]
shell指令碼--判斷使用者的的輸入內容
1.指令碼功能:提示客戶屬於一串數字,並判斷使用者是否進行了輸入,輸入的是否為數字#!/bin/bashread -p "enter a number: " number #提示使用者輸入數字if [ -z $number ];then
linux shell 指令碼 判斷一個檔案是否 存在
/etc/init.d/rcS #!/bin/sh # Start all init scripts in /etc/init.d # executing them in numerical or
shell指令碼判斷當前使用者是否為root(學習筆記一)
可以使用env檢視配置檔案找到USER這個看到當前登入的使用者名稱 [[email protected] shell_project]# env | grep USER USER=root 我把 env查詢出來的內容 使用 grep(查詢) USER 這個出來
shell指令碼載入資料檔案到hive表中
如果執行時間允許,還可以增加判斷hive表是否存在的。 #!/bin/ksh #------------------------------------------------------------------------------------- #-
shell 指令碼執行python指令碼,連線hive提交資料寫入表
使用說明 1.cd /opt/zy 在這個目錄下以root使用者許可權執行命令 2. 在SAP查詢的時候 Tcode:ZMMR0005 Purchase Org * PO Creating:2017/3/1 (開始日期) 2017/
Hive/Shell 建立Hive 庫 ,表指令碼,Hive 動態增加分割槽指令碼
最近工作中使用到了Hive, 並對Hive 的資料庫,表完成建立。建立的表為分割槽表,也涉及到了分割槽表 的按天動態增加分割槽。程式碼組織結構:建立資料庫:create_dmp.hql-- dmp 資料庫儲存了dmp所需要的資料 CREATE DATABASE IF NO
[shell]shell指令碼實現每天自動抽取資料插入hive表
#!/bin/bash source /etc/profile source ~/.bashrc M_DATE=$(date -d'-1 day' +%m) #取系統日期前一天的月份 spark-sql -e" insert overwrite table db.t