Reputation: 439
I'm using Ubuntu 18.04 & Mongodb 3.2.22.
Now, I want to make sure that it'll be always up and running (if it crashes - auto restart).
I searched for a solution and noticed that some people uses respawn
on a file named /etc/init/mongodb.conf
. The thing is, I don't have this file.
Currently when I want to restart I use sudo service mongod restart
.
Any idea how to accomplish that?
Upvotes: 2
Views: 1823
Reputation: 360
if you have set it up via apt, then the systemd service file should be at /etc/systemd/system/multi-user.target.wants/mongodb.service. Under ther service tab in the file, add "Restart=always" and do a systemctl daemon-reload
Upvotes: 3