Thursday, May 2, 2019

Script - MongoDB Uninstallation

#!/bin/sh

#Stop MongoDB
echo "Stopping mongodb"
service mongod stop

#Remove Packages
echo "Removing any MongoDB packages that you had previously installed"
sleep 2
sudo apt-get purge -y mongodb-org*

#Remove Data Directories
echo "Removing MongoDB databases and log files"
sleep 2
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

No comments:

Post a Comment