重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

python开发mongodb启动脚本

#!/usr/bin/env python
#coding:utf-8

import os
import sys

def start():
    os.system('/usr/local/MongoDB/bin/mongod -f /usr/local/mongodb/conf/mongodb.conf')

def stop():
    os.system('/usr/local/mongodb/bin/mongod --shutdown --dbpath /data/mongodb/db')

def status():
    os.system('ps aux | grep mongod | grep -v grep')

def callable(input_key):
    service_option = {'start': start, 'stop': stop, 'status': status}
    return service_option[input_key]()

input_key=sys.argv[1]
callable(input_key)

本文标题:python开发mongodb启动脚本
新闻来源:http://cqcxhl.com/article/jcseho.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP