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???
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With