37 lines
795 B
Bash
37 lines
795 B
Bash
#!/bin/bash
|
|
|
|
# Get date in dd-mm-yyyy format
|
|
NOW="$(date +"%d-%m-%Y")"
|
|
|
|
function file_backup {
|
|
wpbackupfile="wordpress-backup-$NOW.tar.gz"
|
|
oxidbackupfile="oxid-back-$NOW.tar.gz"
|
|
|
|
echo 'WP Files Backup --- building tar File...'
|
|
tar -czf $wpbackupfile /var/html/www/rvv/wp*
|
|
echo '+DONE'
|
|
|
|
echo 'oxid Files Backup --- building tar File...'
|
|
tar -czf $oxidbackupfile /var/html/www/rvv/shop
|
|
echo '+DONE'
|
|
}
|
|
|
|
function oxid_db_backup {
|
|
host=localhost
|
|
user=rvv
|
|
pass=xxxxxxxxx
|
|
db=webshop
|
|
|
|
echo 'oxid DB Export ------> '
|
|
mysqldump --opt --add-drop-table -h$host -u$user -p$pass $db | gzip > oxid-db-$NOW.sql.gz
|
|
}
|
|
|
|
backupdir=~/backup
|
|
cd ~ ; mkdir $backupdir ; cd $backupdir
|
|
|
|
oxid_db_backup
|
|
file_backup
|
|
|
|
# delete old backups
|
|
find /home/dany/backups -mtime +10 -type f -delete
|