Showing posts from December, 2018

Schedule Database backup in your cloud instance

Suppose you have a cloud instance and you’re afraid of loosing data anytime. So what do you do in that case? Backup your database regularly right? But it’s hard to backup manually every day. I’m going to set up a cron job to automatically backup your database. Let’s have a journey with me.
1. Create a local git repository
We’ll create a folder named backups on /var/www. It’ll be our local git repository for backup.
Initialize it with git init2. Create a backup git repository
Since our database isn’t so big yet, we’ll use a git repository to backup the database file for now. Create a git repository in any of your preferred git server. Suppose we create a git repository DatabaseBackupTest and url is [email protected]/DatabaseBackupTest.git cd to your local backup folder and set this url as remote. git remote add origin [email protected]/DatabaseBackupTest.git3. Create a bash script to backup your database
We have to create a bash script that we’ll run on daily or weekly basis to backup our dat…