Created
December 23, 2015 02:48
-
-
Save holin/c82a8493dd113b876bcd to your computer and use it in GitHub Desktop.
backup site
This file contains 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/sh | |
RANDNUMBER=`shuf -i1-10000 -n1` | |
# echo "RANDNUMBER $RANDNUMBER" | |
cd /mnt/bak | |
# backup files | |
echo "backup files..." | |
cp -r /www/web/brch/public_html /root/bak/public_html_`date +"%Y-%m-%d"`_$RANDNUMBER | |
# backup database | |
echo "backup database..." | |
DBNAME=sundongbrch | |
DATE=`date +"%Y%m%d"` | |
SQLFILE=$DBNAME-${DATE}-$RANDNUMBER.sql | |
mysqldump --opt --host=127.0.0.1 --user=dbbackup --password=backuppassword $DBNAME > $SQLFILE | |
gzip $SQLFILE | |
rm -f $SQLFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment