MongoDB start and shutdown - init script

ittechlab
ittechlab used Ask the Experts™
on
I want to write a init script to stop and start the MongoDB.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Why write one?  It appears they can be generated.

Start MongoDB Processes with Init Scripts
The “Make Init Scripts” Tool


https://docs.opsmanager.mongodb.com/current/tutorial/stop-using-automation/
Rahul ShendeJr. Linux System Administrator

Commented:
ittechlabLinux Support

Author

Commented:
Thanks for the github URL.

I have RHEL 7.3 and want to know how to install mongodb.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

ittechlabLinux Support

Author

Commented:
[root@ansible init.d]# /etc/init.d/mongo.sh status
Unit mongo.sh.service could not be found.
Unit mongo.sh.service could not be found.
[root@ansible init.d]#
[root@ansible init.d]#
[root@ansible init.d]# ls -l /etc/init.d/mongo.sh
-rwxr--r--. 1 root root 1025 Aug 22 21:35 /etc/init.d/mongo.sh
ittechlabLinux Support

Author

Commented:
[root@ansible init.d]# rpm -qa | grep mongodb-enterprise
mongodb-enterprise-tools-4.0.1-1.el7.x86_64
mongodb-enterprise-mongos-4.0.1-1.el7.x86_64
mongodb-enterprise-4.0.1-1.el7.x86_64
mongodb-enterprise-shell-4.0.1-1.el7.x86_64
mongodb-enterprise-server-4.0.1-1.el7.x86_64
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>> want to know how to install mongodb

How to install Mongo is a lot different than the question asked.  If that is your real question, I would suggest you delete this question and ask a new one on installing.
ittechlabLinux Support

Author

Commented:
I already installed mongoDB and i need help with the script.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
I was confused by the previous commnet "and want to know how to install mongodb. " and the rpm command outputs.  rpm won't help you with startup/shutdown scripts.

>>and i need help with the script.

I believe we have covered that.  Personally I would use the scripts generated by a script provided by the software provider.

There was also the Git link that was probably from a web search.  I'm sure of you Google/Bing around, you'll find several more.

What pieces are't working for you?
ittechlabLinux Support

Author

Commented:
here is what i did.

- installed mongodb on RHEL 7.3
- took the init script from the following github
https://github.com/syokenz/mongodb-init-script
- when i ran the init script to stop/start didn't work.

I will post the error soon.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
I assume you made the necessary changes that matched your machine?

This is why I would have used the script to generate the init script for you.  If you run the creation script on your machine, it should generate everything it needs.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial