Skip to content

Instantly share code, notes, and snippets.

View ishubhamsingh's full-sized avatar
👨‍💻
Working from home

Shubham Singh ishubhamsingh

👨‍💻
Working from home
View GitHub Profile
@ishubhamsingh
ishubhamsingh / dbbackup.sh
Created March 8, 2018 05:10
A simple script to backup mysql db to a git repository. Can be set to run as a cron job.
#!/bin/sh
mysqldump -u Username -pPassword --all-databases | gzip > ~/db/database_backup.gz ;
cd ~/db/ ;
git add . ;
git commit -m "Backup taken on `date +'%Y-%m-%d %H:%M:%S'`" ;
git push origin HEAD:master ;