PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/metastore/scripts/hive.metastore_ctrl

#
text | 32 lines | 27 code | 5 blank | 0 comment | 0 complexity | 02b0484f4592f2b7bc0d524f37963f66 MD5 | raw file
 1#!/usr/bin/env python
 2# chkconfig: 2345 90 20
 3# description: hive metastore
 4
 5import sys
 6sys.path.append('/usr/local/fbprojects/fb303/scripts')
 7
 8import fb303_scripts
 9
10# thrift python packages need to be installed
11import thrift
12from thrift import protocol, transport
13from thrift.transport import TTransport
14from thrift.protocol import TBinaryProtocol
15from thrift.transport import *
16
17if (len(sys.argv) > 2):
18    port = int(sys.argv[2])
19else:
20    port = 9082
21    
22if (len(sys.argv) > 1):
23    retval = fb303_scripts.service_ctrl('hive.metastore',
24                                        port,
25                                        sys.argv[1],
26                                        binary_name = "start_meta_store_thrift_server.sh",
27                                        trans_factory = thrift.transport.TTransport.TBufferedTransportFactory(),
28                                        prot_factory = TBinaryProtocol.TBinaryProtocolFactory())
29    sys.exit(retval)
30else:
31    print 'metastore_ctrl requires a command: start, stop, restart, reload, force-reload, status, or version'
32    sys.exit(2)