码迷,mamicode.com
首页 > 数据库 > 详细

python开发mongodb启动脚本

时间:2018-06-27 14:10:48      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:bpa   top   utf-8   python开发   开发   input   art   callable   sys   

#!/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启动脚本

标签:bpa   top   utf-8   python开发   开发   input   art   callable   sys   

原文地址:http://blog.51cto.com/yht1990/2133159

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!