Skip to content
Find file
d783087
executable file 55 lines (46 sloc) 1.77 KB
#!/usr/bin/env python
## Copyright (c) 2007-2008 Facebook
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## See accompanying file LICENSE or visit the Scribe site at:
## http://developers.facebook.com/scribe/
'''scribe_ctrl: A simple script for running and monitoring scribe.'''
import sys
#make this work for facebook environment too
isFacebook = 0
if (isFacebook == 1):
# put your own path here!
sys.path.insert(0, '/mytrunk/fbcode-test/common/fb303/scripts')
import fb303_simple_mgmt
else:
from fb303_scripts import *
# thrift python packages need to be installed
import thrift
from thrift import protocol, transport
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
if (len(sys.argv) > 2):
port = int(sys.argv[2])
else:
port = 1463
if (len(sys.argv) > 1):
retval = fb303_simple_mgmt.service_ctrl(sys.argv[1],
port,
trans_factory = TTransport.TFramedTransportFactory(),
prot_factory = TBinaryProtocol.TBinaryProtocolFactory())
sys.exit(retval)
else:
print 'Usage: scribe_ctrl command [port]'
print ' commands: stop counters status version name alive'
sys.exit(2)
Jump to Line
Something went wrong with that request. Please try again.