Skip to main content
saidvs
Gold ⭐️
January 15, 2021
Solved

Oozie ssh action

Hello,

 

I am new to CDH and excuse if its a simple or an easy mistake.

 

I have shell action in oozie which is failing to read a file.

I have simple wrapper script, reading a file and passing the value in file to the next step, but its failing saying file or directory not exist. I could read/see the same file in server.

 

Really appreicate your help on this. 

 

below is my script

 

#!/bin/bash
#to test a sample sqoop script
 
while read line;
do tablename=`echo $line | cut -d'.' -f2` sqoop import --connect "jdbc:sqlserver://ppppppp:1433;database=yyyy" --username userid --password '******' --table $tablename --target-dir hdfs://nameservice1/d/dl/rlsolutions/raw/{$tablename} -m 1 --as-avrodatafile
done < /d/dl/rlsolutions/code/oozie-workflows/rl_solutions/hiveScripts/tables.txt
 
error:
./sample3.sh: line 10: /d/dl/rlsolutions/code/oozie-workflows/rl_solutions/hiveScripts/tables.txt: No such file or directory

 

saidvs
saidvsAnswer
Gold ⭐️
January 19, 2021

changing the code to for loop worked

 

 

for line in `hdfs dfs -cat /d/dl/rlsolutions/code/oozie-workflows/rl_solutions/hiveScripts/tables.txt` do tablename=`echo $line | cut -d'.' -f2` sqoop import --connect "jdbc:sqlserver://pppppp:1433;database=xxxxxxxx" --username yyyyyyyyy--password '$$$$$$$' --table $tablename --target-dir hdfs://nameservice1/d/dl/rlsolutions/raw/$tablename -m 1 --as-avrodatafile done

 

 

1 reply

saidvs
saidvsAuthorAnswer
Gold ⭐️
January 19, 2021

changing the code to for loop worked

 

 

for line in `hdfs dfs -cat /d/dl/rlsolutions/code/oozie-workflows/rl_solutions/hiveScripts/tables.txt` do tablename=`echo $line | cut -d'.' -f2` sqoop import --connect "jdbc:sqlserver://pppppp:1433;database=xxxxxxxx" --username yyyyyyyyy--password '$$$$$$$' --table $tablename --target-dir hdfs://nameservice1/d/dl/rlsolutions/raw/$tablename -m 1 --as-avrodatafile done

 

 

Translate