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启动脚本
转载来源:https://www.cdcxhl.com/article40/jcseho.html

成都网站建设公司_创新互联,为您提供网页设计公司用户体验外贸网站建设企业网站制作网站维护网站排名

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网页设计公司