MongoDB start and shutdown - init script

I want to write a init script to stop and start the MongoDB.
ittechlabLinux SupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) 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 AdministratorCommented:
ittechlabLinux SupportAuthor Commented:
Thanks for the github URL.

I have RHEL 7.3 and want to know how to install mongodb.
Need More Insight Into What’s Killing Your Network

Flow data analysis from SolarWinds NetFlow Traffic Analyzer (NTA), along with Network Performance Monitor (NPM), can give you deeper visibility into your network’s traffic.

ittechlabLinux SupportAuthor 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 SupportAuthor 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
slightwv (䄆 Netminder) 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 SupportAuthor Commented:
I already installed mongoDB and i need help with the script.
slightwv (䄆 Netminder) 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 SupportAuthor 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.
slightwv (䄆 Netminder) 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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.