sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abraham Elmahrek <...@cloudera.com>
Subject Re: Run sqoop from .sh script
Date Tue, 08 Apr 2014 13:56:19 GMT
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 <Sandipan.Ghosh@target.com>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
>

Mime
View raw message