mongodb开机启动

时间:2017-08-10 12:39:30   收藏:0   阅读:311
#!/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

 

原文:http://www.cnblogs.com/feiyun126/p/7338579.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!