Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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