Koushik Chandra
Koushik Chandra

Reputation: 1491

how to execute sqoop from shell script

I have created a file in a shell script where I have written the sqoop command. Now I want to invoke that sqoop command from shell script, means I want to give that file as input for sqoop. Can anyone please let me know how can I achieve this?

Upvotes: 0

Views: 1463

Answers (1)

Koushik Chandra
Koushik Chandra

Reputation: 1491

It works for me after executing the sqoop command from a child shell. The below portion code works for me.

sqoop_cmd=$tablename"_sqoop"

echo "./sqoop import --connect $source_db_url --username $db_user_nm --password $db_password --table $tbl_nm_upr --direct --fields-terminated-by '|'" > $sqoop_cmd

chmod 777 $sqoop_cmd

prev_dir=$PWD

cd $sqoop_dir

$prev_dir/$sqoop_cmd &

wait

Upvotes: 1

Related Questions