script. cron .
ssh root@hostname "mongodump --db myDatabaseName --out /tmp/mongo-backup ; zip -r /tmp/mongo-backup$(date "+%Y.%m.%d").zip /tmp/mongo-backup ; rm -rf /tmp/mongo-backup" ;
scp root@hostname:/tmp/mongo-backup$(date "+%Y.%m.%d").zip ./
script .
- Runs the mongodump script and creates a ZIP file, for example: mongo-backup2017.03.02.zip
- Download this file via SCP to your local machine.
source
share