Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Return code for beeline command in shell script
Labels:
- Labels:
-
Apache Hive
Explorer
Created ‎07-31-2018 02:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to capture the return code of the Beeline command that I am executing within a Shell Script. Like Below:
beeline -u $Beeline -e "ALTER TABLE DROP if exists partition (date='');"
I want to capture the status of above query with in shell script.
Thanks AG
1 REPLY 1
Guru
Created ‎07-31-2018 04:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Atul Goel!
Did you try the following command?
[hive@node3 ~]$ beeline -u 'jdbc:hive2://node2:2181,node3:2181,node4:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' --showNestedErrs --showWarnings --verbose -e "select 1 + 1;" 2> /tmp/beeline.out [hive@node3 ~]$ cat /tmp/beeline.out issuing: !connect jdbc:hive2://node2:2181,node3:2181,node4:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 '' [passwd stripped] Connecting to jdbc:hive2://node2:2181,node3:2181,node4:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 Connected to: Apache Hive (version 1.2.1000.2.6.5.0-292) Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292) Transaction isolation: TRANSACTION_REPEATABLE_READ Executing command: select 1 + 1; Getting log thread is interrupted, since query is done! 1 row selected (0.218 seconds) Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive Closing: 0: jdbc:hive2://node2:2181,node3:2181,node4:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Hope this helps!
