How can I stop mongodb from starting on system boot
22,394
Solution 1
I can't test it at the moment, but I think this should work
sudo update-rc.d mongodb disable
If this is not enough try this
sudo update-rc.d -f mongodb remove
Solution 2
This is borrowed from this answer:
echo manual | sudo tee /etc/init/mongod.override
Solution 3
This worked for me and I'm using Ubuntu 18.04:
sudo systemctl disable mongod
Solution 4
@davelupt's reference is great. However I guess the command should be
echo manual | sudo tee /etc/init/mongod.override
since the file for MongoDB under /etc/init is mongod.conf
.
Related videos on Youtube
Author by
segmentationfaulter
Updated on September 18, 2022Comments
-
segmentationfaulter over 1 year
I installed mongodb for learning purpose, the problem I am facing is that it starts on system boot and consume resources even if not being used. I want it to be removed from system boot, how can I do this?
-
A.B. over 8 yearsFrom how much resources are you talking about?
-
Mostafa Ahangarha about 8 yearsPossible duplicate of How to enable or disable services?
-
mchid over 7 yearsIf you are using a recent version of ubuntu, you probably need to follow the instructions for systemd on how to "disable" a service: askubuntu.com/questions/19320/… ; you can also "mask" a service if you want to completely disable the service. If you "disable" a service it will not automatically start at boot time. If you "mask" a service, it will not be able to be started and will be completely disabled.
-
-
Samuel G. P. about 8 yearsYep, the first one worked to me :)
-
mchid over 7 yearsOn 16.10 and 16.04, I'm showing
/etc/init/mongodb.conf
when I run either one of the following commands:dpkg -L mongodb-server | grep /etc/init/mongod
orapt-file search /etc/init/mongod
-
Hector Correa about 7 yearsAs Robert indicated in his answer, this works but the file should be
mongod.override
(not mongodb) -
Peter T. over 3 yearsWith mongodb version v3.6.8 on linux mint 20 the service is called
mongodb
(and not justmongod
), so I can disable it withsudo systemctl disable mongodb
.