Reputation: 1011
I want to Do the Backup and restore with automated Process. I am looking for MongoDB native features as it takes very less time to do the backup and restores as compare to Other NPM Modules.
So for that, I have created the Shell script which is as follow:
#!/bin/sh
DIR=`date +%m%d%y`
DEST=/db_backups/$DIR
mkdir $DEST
mongodump -h 127.0.0.1:27017 -d mydbname -o $DEST
Now I want to Run this script through cron. What is the best approach for doing this? I am on nodejs Windows Environment. Any help is really appreciated.
Upvotes: 1
Views: 127
Reputation: 1011
For that we have to open CMD and create the Job which can be run according to your reqirement. Code will be on CMD is
schtasks /create /tn "mongodb_automated_job" /tr "location/mongo.sh" /sc minute /mo 1
It will run every minute.
Upvotes: 1