Simple shell script to backup your websites, databases and maybe more...
Just git clone the repo on your server.
Setup variables between BEGIN Configuration and END Configuration.
# Number of days to retain backups (default: 10 days)
date=$(date +%Y%m%d)
deldate=`date --date '10 days ago' "+%Y%m%d"`Change 10 days ago by whatever you want
Source directory where your websites are:
# Source directory
sourcedir="/my/source/directory"Destination directory where your backups will be saved:
# Destination direcrtory (backups directory)
destdir="/my/destination/directory"List up the websites directories you want to backup:
# Websites (separated by spaces)
sites='website1 website2 website3'Your MySQL host (default: localhost):
# Database host
db_host='localhost'Your MySQL user:
# Database user
db_user='my_db_user'Your MySQL password:
# Database password
db_password='my_db_password'chmod u+x friendly-backup.sh./friendly-backup.sh
Optional: Add a Cron Job
- Add a way to backup config files too
- Alternative backup for other DBMS
- Make an interactive setup?
Hey dude! Help me out for a couple of 🍻!