Hey there,
You should just be able to put your sqoop commands in series:
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table b --split-by a
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table c --split-by a
The CLI should return 0 or 1 depending on the success of the job. So you
can provide conditions:
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table b --split-by a
if [[ $? -e 0 ]]; then
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table c --split-by a
fi;
Also, this means you can use "set -e" to tell the script to exit if any one
command fails:
set -e
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table b --split-by a
sqoop import --connect jdbc:mysql:///test --username root --password
hue --table c --split-by a
For running the commands first, then adding to a .sh file, you can manually
add the commands you've previously ran. You can find these commands via
bash history. Type "history" from the command line to get a full list of
commands you've entered for your current session.
-Abe
On Tue, Apr 8, 2014 at 4:51 AM, Sandipan.Ghosh <[email protected]>wrote:
>
>
> Hi,
>
>
>
> I want to run multiple Sqoop commands saving into a .sh file then
> executing that from bash shell.
>
>
>
> How will I do it?
>
>
>
> Thanks
>
> Snadipan
>