HUE中oozie執行shell


Oozie執行Shell,傳入參數
1. 新建一個workflow

 

2. 拖入一個shell

 

3. shell腳本如下

#!/bin/sh
sqoop import --connect jdbc:mysql://localhost:3306/spider_new --username root --password 1234qwer --target-dir /user/fengz/brand/spider_data/amac/amac_fund_$1 --delete-target-dir --fields-terminated-by '`' --query select * from amac_fund where update_time between '$2' and '$3' and \$CONDITIONS -m 1

這是在命令行可執行的命令,其中有三個動態參數,$1、$2、$3,此處做了一個import的導入操作,把指定數據抽取到HDFS路徑下,用了--query寫SQL語句抽取想要的數據,此處需要注意,如果使用--query,必須要帶\$CONDITIONS,否則執行失敗。
4. 添加參數

 

5. 啟動,填入參數

 

6. 這樣就避免了在oozie使用sqoop時參數不能帶空格的情況

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM