本文整理汇总了Python中Library.services_control方法的典型用法代码示例。如果您正苦于以下问题:Python Library.services_control方法的具体用法?Python Library.services_control怎么用?Python Library.services_control使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library.services_control方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Library [as 别名]
# 或者: from Library import services_control [as 别名]
#.........这里部分代码省略.........
serviceControl = optparse.OptionGroup(parser, 'Services Control')
serviceControl.add_option('--start', action='store_true', default=False,dest='startServices',help='launch Scheduler or API daemon. Additionally you can specify interface and port. Example: "ccmsh --start api eth0 2020"')
serviceControl.add_option('--stop', action='store_true', default=False,dest='stopServices',help='stop Scheduler or API daemon')
serviceControl.add_option('--show', action='store_true', default=False,dest='showServices',help='show OS information on Scheduler or API daemon')
listEmulator = optparse.OptionGroup(parser, 'List available emulators')
listEmulator.add_option('-e', '--emu', action='store_true', default=False,dest='listAllEmulators',help='lists all available emulators and gives emulator details by name')
parser.add_option_group(config)
parser.add_option_group(listEmu)
parser.add_option_group(listDistro)
parser.add_option_group(listEmulator)
parser.add_option_group(createEmu)
parser.add_option_group(deleteEmu)
parser.add_option_group(serviceControl)
options, arguments = parser.parse_args()
if options.version:
noExtraOptions(options, "version")
VERSION = getVersion()
os.system("clear")
text = '''
___ _____ ___ _____ __ __ __
/ __)( _ )/ __)( _ )( \/ ) /__\
( (__ )(_)(( (__ )(_)( ) ( /(__)\
\___)(_____)\___)(_____)(_/\/\_)(__)(__) '''+ "v"+VERSION+'''
Copyright 2012-2013 SAP Ltd
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.
COCOMA is a framework for COntrolled COntentious and MAlicious patterns.
More info @ https://github.com/cragusa/cocoma
'''
print text
sys.exit(1)
#catch empty arguments
#if len(arguments)>0:
'''
################################
serviceControl
###############################
'''
if options.startServices:
noExtraOptions(options, "startServices")
if len(arguments)>0:
cliCommand=""
if arguments[0] == "scheduler":
print "Starting ",arguments[0]
#generate CLI command
try:
n=1
while n !=len(arguments):
cliCommand =cliCommand+" "+arguments[n]+" "
n+=1
except Exception,e :
print "No additional arguments were supplied to scheduler:",e
Library.services_control("scheduler","start"," ")
Library.services_control("scheduler","start",cliCommand)
if arguments[0] == "api":
print "Starting ",arguments[0]
#generate CLI command
try:
n=1
while n !=len(arguments):
cliCommand =cliCommand+" "+arguments[n]+" "
n+=1
except Exception,e :
print "No additional arguments were supplied to API:",e
Library.services_control("api","start"," ")
print "Starting ",arguments[0],cliCommand
Library.services_control("api","start",cliCommand)
示例2: noExtraOptions
# 需要导入模块: import Library [as 别名]
# 或者: from Library import services_control [as 别名]
print "No additional arguments were supplied to API:",e
Library.services_control("api","start"," ")
print "Starting ",arguments[0],cliCommand
Library.services_control("api","start",cliCommand)
else:
print "No arguments supplied, check help"
#Library.services_control("api","start","")
if options.stopServices:
noExtraOptions(options, "stopServices")
if len(arguments)>0:
if arguments[0] == "scheduler":
Library.services_control("scheduler","stop"," ")
Library.killRemainingProcesses()
elif arguments[0] == "api":
Library.services_control("api","stop"," ")
else:
print "Wrong arguments check help"
else:
print "No arguments supplied, check help"
if options.showServices:
noExtraOptions(options, "showServices")
if len(arguments)>0:
if arguments[0] == "scheduler":
Library.services_control("scheduler","show"," ")