linux的shell脚本启动mongos出错,求指导!!急求
#t src/mongo/shell/mongo.js:L114/usr/bin/bash
LOGPATH=/var/log/mongo
CONFIGDB=192.168.1.210:40000,192.168.1.211:4001,192.168.1.212:40002
#stop mongos server
stopserver()
{
sudo pkill mongos
#sudo service mongos stop
}
#start mongos server
mongosserver()
{
sudo mongos -port 33333 -configdb $CONFIGDB -logpath $LOGPATH/mongos_t.log -logappend -fork
}
usage()
{
echo "useage:start_mongos_kwlib.sh all|stop"
}
if [ $1 == "all" ]; then
stopserver
mongosserver
elif [ $1 == "stop" ]; then
stopserver
else
usage
fi
shell脚本,用来启动和停止mongos服务操作,但是不知道哪里出错了。报错信息如下,
: command not foundb.sh: line 2:
: command not foundb.sh: line 4:
'/start_mongos_kwlib.sh: line 6: syntax error near unexpected token `
'/start_mongos_kwlib.sh: line 6: `stopserver()
蛋疼死了,比较急,求解!!!!!
------解决方案--------------------补充:
if [ $1 == "all" ]; then ==》if [ "$1" == "all" ]; then
elif [ $1 == "stop" ]; then ==> elif [ "$1" == "stop" ]; then