30 lines
612 B
Bash
30 lines
612 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
BACKUPFILE=$1
|
||
|
BACKUPZIEL=$2
|
||
|
|
||
|
NOW="$(date +"%d-%m-%Y")"
|
||
|
|
||
|
function db_backup {
|
||
|
# Vars
|
||
|
host=localhost
|
||
|
user=XXXXXXX
|
||
|
pass=XXXXXXX
|
||
|
db=wordpress
|
||
|
|
||
|
mysqldump --opt --add-drop-table -h$host -u$user -p$pass $db wp-db.sql
|
||
|
}
|
||
|
|
||
|
function file_backup {
|
||
|
cd /home/dany/local-dev/wp
|
||
|
tar -cJf ~/tmp/$BACKUPFILE-$NOW.tar.xz wp-content/themes wp-content/uploads #./wp-db-$NOW.sql
|
||
|
}
|
||
|
|
||
|
function upload {
|
||
|
/usr/bin/rsync -aze 'ssh -p 64322 -i /home/dany/.ssh/server-key' /home/dany/tmp/$BACKUPFILE-$NOW.tar.xz server-name-hier:/home/dany/backups/* >> backup.log 2>&1
|
||
|
}
|
||
|
|
||
|
# Funktionsaufrufe
|
||
|
db_backup
|
||
|
file_backup
|
||
|
upload
|