Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongo mongod init.d script not working on CentOS

Tags:

mongodb

init.d

I am trying to figure out why the provided init.d script is not working on CentOS. I tried starting it manually:

/etc/init.d/mongod start

But I get the following error:

Starting mongod: /usr/bin/dirname: extra operand `2>&1.pid'
Try `/usr/bin/dirname --help' for more information.

I looked in the script where it tries to start:

  daemon --user "$MONGO_USER" "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1"

So I looked where mongod var is defined:

mongod=${MONGOD-/usr/bin/mongod}

Also tried:

service mongod start

Same error.

Not sure what I have setup wrong, but I have verified that I have the latest script but I cannot get mongod process to start.

Any ideas???

like image 208
lostintranslation Avatar asked Nov 05 '14 19:11

lostintranslation


1 Answers

The following link appears to address the issue well https://ma.ttias.be/mongodb-startup-dirname-extra-operand-pid/

In a nutshell, a bad script appears to have been distributed but the output it produces is not harmful, mongod still runs. If you run yum update you'll get a fixed script, but likely mongod will still fail because the script was not making it fail. Check your mongo logs (usually /var/log/mongodb/mongod.log, but can be different if specified in differently in /etc/mongod.conf). The log file should tell you the real reason it's failing.

like image 176
David Sacks Avatar answered Oct 01 '22 01:10

David Sacks