Skip to content
Snippets Groups Projects
Commit 11e9b1e9 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Fix mongod.sh for Ubuntu 14.04

parent dc8211aa
Branches
Tags
No related merge requests found
Pipeline #
......@@ -42,16 +42,17 @@ startMongo ()
{
echo -e "Starting MongoDB daemon with data from ${MONGO_DATA_PATH}\n";
httpinterface="--httpinterface"
${MONGO_MONGOD} --version | grep "db version v2.4.9" && httpinterface="" #this flag does not exist on ubuntu 14.04
${MONGO_MONGOD} --version | grep -q "db version v2.4.9" && httpinterface="" #this flag does not exist on ubuntu 14.04
cmd_start="${MONGO_MONGOD} --fork --nojournal --dbpath \"${MONGO_DATA_PATH}\" --smallfiles --rest $httpinterface --logpath \"$MONGO_LOG_PATH/mongod.log\""
$cmd_start
eval "$cmd_start"
exitcode=$?
if [ "$exitcode" -eq "100" ]; then
echo "Tried to execute:"
echo " $cmd_start"
echo "MongoDB failed start with exit code $exitcode. Trying to repair!"
cmd_repair="${MONGO_MONGOD} --dbpath \"${MONGO_DATA_PATH}\" --repair"
$cmd_repair
eval "$cmd_repair"
exitcode=$?
if [ "$exitcode" -ne "0" ]; then
echo "Tried to execute:"
......@@ -59,7 +60,7 @@ startMongo ()
echo "Failed to repair MongoDB! Exit code was $exitcode"
exit $exitcode
else
$cmd_start
eval "$cmd_start"
exitcode=$?
if [ "$exitcode" -ne "0" ]; then
echo "MongoDB failed start with exit code $exitcode after it was repaired. Something is wrong!"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment