A Confession
I have not had a proper backup routine in place for Kountr.
If the hard disk on my shared, remote server were to have been lost, all of the content on Kountr would have been lost with it. I have the application stored locally, but the DB is in one place.
I have setup a cron job on the server to dump the db nightly. I will run another cronjob on my computer to copy these dumps daily. Once the first one is complete I will go through the restore routine to make sure everything works.
In case anyone else is bootstrapping their own web app and don’t want to take the time to figure out the nightly back up here are some tips.
1. To create a nightly cronjob;
export EDITOR=vi
crontab -e
20 3 * * 0-6 command
This will run command at 3:20am everyday
2. Command for dumping a db and zipping it;
pg_dump -F t DBNAME | gzip > FILENAME
3. Getting a date in the filename;
Insert $(date +%d%b%Y) in your filename string
Good luck.
Leave a comment