Mongo Backup and Cleanup of Old Backups
This script takes a backup of the MongoDB database and stores it in the /opt/mongobackup folder. If there is more than one backup, it keeps the 2 most recent ones and deletes the others.
Edit the {IP},{Username},{Password} fields specified for the script according to your own DB information.
POWERSHELL
POWERSHELL
POWERSHELL
If you wish, you can have the script run at a specific time or time period. Cron can be used for this.
POWERSHELL
Add the following line to the opened file.
POWERSHELL
In the example usage, the script will run at 23:59 on the 1st day of each month.