Support Questions

Find answers, ask questions, and share your expertise

Oozie ssh action

avatar
Explorer

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

 

1 ACCEPTED SOLUTION

avatar
Explorer

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
 

 

View solution in original post

1 REPLY 1

avatar
Explorer

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