#!/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 -i /path/to/ssh-keyfile' \ /home/dany/tmp/$BACKUPFILE-$NOW.tar.xz server-name-hier:target-dir/ >> backup.log 2>&1 #oder #scp /home/dany/tmp/$BACKUPFILE-$NOW.tar.xz server-name-hier:target-dir/ >> backup.log 2>&1 } # Funktionsaufrufe db_backup file_backup upload