35 lines
631 B
Bash
35 lines
631 B
Bash
#!/bin/bash
|
|
|
|
function db_backup {
|
|
|
|
# Vars
|
|
host=localhost
|
|
user=XXXXXXX
|
|
pass=XXXXXXX
|
|
db=wordpress
|
|
|
|
echo 'DB Export ------> '
|
|
mysqldump --opt --add-drop-table -h$host -u$user -p$pass $db | gzip > wp-db.sql.gz
|
|
}
|
|
|
|
function file_backup {
|
|
backupfile="wordpress-backup.tar"
|
|
|
|
echo 'File Backup --- building tar File...'
|
|
tar -cf $backupfile ~/wp*
|
|
echo '+DONE'
|
|
}
|
|
|
|
|
|
echo '-------------------------------------------'
|
|
echo 'Tolles Backup Script'
|
|
echo '-------------------------------------------'
|
|
|
|
backupdir=backup
|
|
|
|
cd ~ ; mkdir $backupdir && cd $backupdir || { echo "FEHLER!!!!"; exit 1 }
|
|
|
|
# Funktionsaufrufe
|
|
db_backup
|
|
file_backup
|