Easy backup script for Meteor App
- Create a backup directory where you want to store your backup. EG.
/backup - Change the variable of the script to your liking.
dbNameis the name of the MongoDB base.cfsLocis the location of your CFS directory if needed.curdateis the date command format you want to use.backupLocis the directory you've created to store your backup.
- Set a cron to run the script when you want. EG.
0 2 * * 0 sh /backup/backup.sh >> /backup/logs 2>&1 for every monday at 2:00 AM.
If your backup are store in /backup, as root, run the following command:
sh /backup/backup.sh >> /backup/logs 2>&1
If your backup are store in /backup, as root, run the following commands where 11-11-11 is the backup date:
tar -xf mongo-11-11-11.tar.gz -C mongo-11-11-11mongorestore --dir mongo-11-11-11tar -xf cfs-11-11-11.tar.gz -C cfs-11-11-11cp -r cfs-11-11-11 /opt/mywebsite/cfsrm -r mongo-11-11-11 cfs-11-11-11
To restore in dev environment :
mongorestore --dir mongo-11-11-11/SITENAME -h IPADDRESS --port PORT -d DATABASENAME