最新消息: 新版网站上线了!!!

mongodb启动脚本

#!/bin/bash
 
MONGOD=/usr/local/mongodb/bin/mongod
 
mongod_start(){
    $MONGOD --dbpath /usr/local/mongodb/data --fork --logpath /usr/local/mongodb/logs
    }
mongod_stop(){
    killall -2 mongod
    }
 
case "$1" in 
start)
    echo start...
    mongod_start
    if [ $? == 0 ];then
        echo "Secuss start MongoDB!"
    fi
    ;;
stop)
    mongod_stop
    if [ $? == 0 ];then
        echo "MongoDB is shutdown now !"
    fi
    ;;
restart)
    mongod_stop
    mongod_start
    ;;
*)
    echo "Use args (start|stop|restart)"
    ;;
esac
 

转载请注明:谷谷点程序 » mongodb启动脚本