#!/bin/bash
# chkconfig: 345 85 15
# description: mongo is a database server
# processname: mongod
mongo="/a/b/logs/mongod"
. /etc/rc.d/init.d/functions
case $1 in "start")
cd $mongo
nohup /a/b/mongodb/bin/mongod --dbpath=/a/b/data/mongodb --fork --logpath=/a/b/logs/mongod/mongo.log --logappend >/dev/null &
if [ $? == "0" ];then
echo "mongo start ok"
else
echo "please check the log"
fi
;;
"stop")
cd /a/b/mongodb/bin
./mongo admin --eval "db.shutdownServer()"
if [ "$?" == "0" ];then
echo " ---`date +%y-%m-%d-%H-%M-%S` ----mongd stop ok" >> $mongo/mongostop.log
else
echo "please check the log"
fi
;;
esac
阅读(7761) | 评论(1) | 转发(0) |