#!/bin/bash
 #
 #chkconfig: 2345 80 90
 #description: mongodb

 start() {
   /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/mongo_data --logpath=/usr/local/mongodb/logs/mongodb.log --logappend --fork
  }

 stop() {
   /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/mongo_data --logpath=/usr/local/mongodb/logs/mongodb.log --logappend --fork --shutdown
 }

 case "$1" in
   start)
  start
  ;;

 stop)
  stop
  ;;

 restart)
  stop
  start
  ;;
   *)
  echo 
 $"Usage: $0 {start|stop|restart}"
  exit 1
 esac
chmod +x /etc/rc.d/init.d/mongodb
chkconfig --add mongodb
chkconfig --level 345 mongodb on
chkconfig --list mongodb

 

posted on 2017-08-10 12:01  网络终结者  阅读(237)  评论(0编辑  收藏  举报