#!/bin/bash NOW="$(date +"%d-%m-%Y")" # websites folder WEBSITESDIR="." # local backup folder BACKUPDIR="./backups" if [ ! -d $BACKUPDIR ]; then mkdir $BACKUPDIR fi # Array declare -a liste # Unterverzeichnisse von html die gebackuppt werden sollen liste=( "omikron" "amazon.de" "spiegel.de" "google.de" "omikron/china" "omikron/swiss" ) # websites function create_websites_backup { cd $WEBSITESDIR for i in "${liste[@]}"; do if [ -d $i ]; then tag=$(echo $i | sed 's/\//-/') tar -zcf $BACKUPDIR/$tag-$NOW.tar.gz $WEBSITESDIR/$i else echo "File or Directory $i not found!\n" fi done } function do_sql_backup { cd $BACKUPDIR tag=db-$4-$NOW mysqldump --opt --add-drop-table -h$1 -u$2 -p$3 $4 | gzip > $tag.sql.gz } #do_sql_backup "localhost" "db_user" "secret_pw" "db_name" create_websites_backup cd -