npm install iridium_mongodb_backup
var db_backup = require('iridium_mongodb_backup');
db_backup.config({
db: '<Database Name>', // Required
output: '<Output to local Directory>', // Required
dir_prefix: '<Directory prefix>', // Optional
deleteLocal: true | false,
s3Upload: true | false, // Default: false, Optional
accessKeyId: '<AWS accessKeyId>',
secretAccessKey: '<AWS secretAccessKey>',
bucket: '<AWS Bucket name>',
region: '<AWS Bucket Region Name>',
debug: true | false // Default: true, Optional
});
db_backup.run();
db_backup.schedule('<Schdule>');
We use node-cron to run cron jobs, This is a quick reference to cron syntax and also shows the options supported by node-cron.
# ┌────────────── second (optional)
# │ ┌──────────── minute
# │ │ ┌────────── hour
# │ │ │ ┌──────── day of month
# │ │ │ │ ┌────── month
# │ │ │ │ │ ┌──── day of week
# │ │ │ │ │ │
# │ │ │ │ │ │
# * * * * * *
field | value |
---|---|
second | 0-59 |
minute | 0-59 |
hour | 0-23 |
day of month | 1-31 |
month | 1-12 (or names) |
day of week | 0-7 (or names, 0 or 7 are sunday) |