11
This commit is contained in:
@@ -8,14 +8,15 @@ WEBSITESDIR="."
|
||||
# local backup folder
|
||||
BACKUPDIR="./backups"
|
||||
|
||||
# Erstelle backupdir falls nicht vorhanden
|
||||
if [ ! -d $BACKUPDIR ]; then
|
||||
mkdir $BACKUPDIR
|
||||
fi
|
||||
|
||||
|
||||
# Unterverzeichnisse von html die gebackuppt werden sollen
|
||||
# Array
|
||||
declare -a liste
|
||||
# Unterverzeichnisse von html die gebackuppt werden sollen
|
||||
|
||||
liste=(
|
||||
"omikron"
|
||||
"amazon.de"
|
||||
@@ -25,11 +26,11 @@ liste=(
|
||||
"omikron/swiss"
|
||||
)
|
||||
|
||||
|
||||
# websites
|
||||
function create_websites_backup {
|
||||
|
||||
cd $WEBSITESDIR
|
||||
|
||||
# Unter Verwendung des Array $liste
|
||||
for i in "${liste[@]}"; do
|
||||
if [ -d $i ]; then
|
||||
tag=$(echo $i | sed 's/\//-/')
|
||||
@@ -38,9 +39,15 @@ function create_websites_backup {
|
||||
echo "File or Directory $i not found!\n"
|
||||
fi
|
||||
done
|
||||
|
||||
# oder unter Verwendung einer Datei mit der Verz. Liste
|
||||
# while read i; do
|
||||
# tar -zcf $BACKUPDIR/$tag-$NOW.tar.gz $WEBSITESDIR/$i
|
||||
# done < 'backup-list.txt'
|
||||
|
||||
}
|
||||
|
||||
|
||||
# mysql backup
|
||||
function do_sql_backup {
|
||||
cd $BACKUPDIR
|
||||
tag=db-$4-$NOW
|
||||
|
@@ -6,7 +6,7 @@ REMOTE_HOST=XXX
|
||||
|
||||
# rsync options
|
||||
# -a = Archive Mode
|
||||
# -v = Verbode - für das log file
|
||||
# -v = Verbose - für das log file
|
||||
# -z = Compress
|
||||
# -e = specify the remote shell to use
|
||||
/usr/bin/rsync -avze 'ssh -i /home/$USERNAME/.ssh/rsync-key' $REMOTE_HOST:/home/$USERNAME/backups/* /local/backup/dir/ >> backup.log 2>&1
|
||||
|
10
beispiele/11/rsync-check.sh
Normal file
10
beispiele/11/rsync-check.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# rsync-check.sh
|
||||
|
||||
set -- $SSH_ORIGINAL_COMMAND
|
||||
cmd="$1"; shift
|
||||
case "$cmd" in
|
||||
scp|rsync) exec "$cmd" "$@" ;;
|
||||
*) echo "ERROR: request not permitted" ;;
|
||||
esac
|
Reference in New Issue
Block a user