Nested quotes are not properly escaped here https://github.com/mongodb/mongo/blob/master/rpm/init.d-mongod#L41, causing PIDFILEPATH and PIDDIR to not get set.
sudo service mongod status /etc/init.d/mongod: command substitution: line 41: unexpected EOF while looking for matching `'' /etc/init.d/mongod: command substitution: line 42: syntax error: unexpected end of file dirname: missing operand Try 'dirname --help' for more information. mongod is stopped