Created
August 24, 2017 05:59
-
-
Save yabasha/bb28edf333579e2e7bdb2a25308e71ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Purpose = Backup of Important Data | |
#Created on 15-08-2017 | |
#Author = Bashar Ayyash | |
#Version 2.5 | |
#START | |
TIME=`date +%b-%d-%y%s` # This Command will add date in Backup File Name. | |
FILENAME=backup-$TIME.tar.gz # Here I define Backup file name format. | |
SRCDIR=~/www # Location of Important Data Directory (Source of backup). | |
DESDIR=~/backup # Destination of backup file. | |
SNF=~/mydata.snar # Snapshot file name and location | |
#Delete files older than 1 day | |
sudo find ~/backup -mtime +1 -type f -delete | |
#Add to the log | |
echo "Deleted on: "$TIME >> ~/backup/files.log | |
#export mysql database | |
mysqldump rfsan_db > $DESDIR/backup-$TIME.sql | |
#compress www folder | |
sudo tar -zcf $DESDIR/$FILENAME $SRCDIR #Backup Command | |
#END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment