源码之家

  • 首页
  • 文章
  • 问答
  • 下载
您的位置: 首页  >  文章  >  python开发mongodb启动脚本

python开发mongodb启动脚本

分类: 文章 • 2022-03-31 12:54:38

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)

相关推荐

  • 【Windows】Python脚本随机启动
  • 用Python如何开发Excel宏脚本?新手必学
  • appium+安卓+seleium+python自动化启动计算器小脚本
  • 【python学习笔记:Django】2.启动虚拟环境库出错——Windows PowerShell中无法加载文件 xxx\Scripts\Activate.ps1,因为在此系统上禁止运行脚本
  • Python完成monkey测试脚本开发
  • Python自动化刷投票脚本开发程序分享
  • 基于python的数据采集以及可视化脚本的开发(超详细)
  • 快速安装mongodb脚本,启动
  • python 全栈开发,Day142(flask标准目录结构, flask使用SQLAlchemy,flask离线脚本,flask多app应用,flask-script,flask-migrate,p...
  • 【干货】iData二次开发——以脚本语言Python为例
  • 达策加入ACloudster联盟,携手SAP开展全球业务
  • 移植libnoPoll到SylixOS遇到的问题总结
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 源码之家    备案号:   粤ICP备20058927号