本文整理汇总了Python中cloudmesh_base.Shell.Shell.which方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.which方法的具体用法?Python Shell.which怎么用?Python Shell.which使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_base.Shell.Shell
的用法示例。
在下文中一共展示了Shell.which方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import which [as 别名]
def start(self):
try:
mongod = Shell.which("mongod")
command = [
mongod,
"--dbpath", str(self.db_path),
"--port", str(self.port),
"--fork",
"--logpath", str(self.log_file),
"--bind_ip", "127.0.0.1"
]
print(" ".join(command))
#a = subprocess.call(command)
os.system(" ".join(command))
os.system ("ps aux | fgrep mongod |fgrep -v fgrep")
Console.ok("MongoDB has been deployed")
self.info()
except Exception, e:
Console.error("we had a problem starting the mongo daemon")
print(e)
Console.error("MongoDB has stopped")
# TODO remove the exit in final code, for debugging only
sys.exit()
示例2: start
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import which [as 别名]
def start(self):
"""
starts the database service
:return: the pid
"""
if self.isup():
_pid = self.pid()
Console.error("A mongod process on port {:} is already running with pid {:}".format(self.port, _pid))
return
else:
Console.ok("STARTING")
try:
mongod = Shell.which("mongod")
command = [
mongod,
"--dbpath", str(self.db_path),
"--port", str(self.port),
"--fork",
"--logpath", str(self.log_file),
"--bind_ip", "127.0.0.1"
]
print(" ".join(command))
# a = subprocess.call(command)
os.system(" ".join(command))
self.ps()
Console.ok("MongoDB has been deployed")
self.info()
return None # implement the return of the pid for the process.
# store the pid in self.pid
except Exception, e:
Console.error("we had a problem starting the mongo daemon")
print(e)
Console.error("MongoDB has stopped")
# TODO remove the exit in final code, for debugging only
sys.exit()