Inhaltsverzeichnis

Backup

Ubuntu

Ubuntu nutzt Deja-dup 1), das wiederum auf duplicity basiert.

Duplicity-Backup-script von Hetzner: http://wiki.hetzner.de/index.php/Duplicity_Script

Zugänglich via Systemeinstellungen→Sicherung

Beim 1. Backup fragt einen das Programm, ob man verschlüsseln will… (und arbeitet dabei mit der .ICEauthority)

Debian-Server

neues Script: 2)

#!/bin/bash
#
# Simple script for creating backups with Duplicity.
# Full backups are made on the 1st day of each month or with the 'full' option.
# Incremental backups are made on any other days.
#
# USAGE: backup.sh [full]
#

# get day of the month
DATE=`date +%d`

# Set protocol (use scp for sftp and ftp for FTP, see manpage for more)
BPROTO=scp

# set user and hostname of backup account
BUSER='u10000'
BHOST='u10000.your-backup.de'

# Setting the password for the Backup account that the
# backup files will be transferred to.
# for sftp a public key can be used, see:
# http://wiki.hetzner.de/index.php/Backup
#BPASSWORD='yourpass'

# directories to backup (use . for /)
BDIRS="etc home srv ."
TDIR=`hostname -s`
LOGDIR='/var/log/duplicity'

# Setting the pass phrase to encrypt the backup files. Will use symmetrical keys in this case.
PASSPHRASE='yoursecretgpgpassphrase'
export PASSPHRASE

# encryption algorithm for gpg, disable for default (CAST5)
# see available ones via 'gpg --version'
ALGO=AES

##############################

if [ $ALGO ]; then
 GPGOPT="--gpg-options '--cipher-algo $ALGO'"
fi

if [ $BPASSWORD ]; then
 BAC="$BPROTO://$BUSER:$BPASSWORD@$BHOST"
else
 BAC="$BPROTO://$BUSER@$BHOST"
fi

# Check to see if we're at the first of the month.
# If we are on the 1st day of the month, then run
# a full backup. If not, then run an incremental
# backup.

if [ $DATE = 01 ] || [ "$1" = 'full' ]; then
 TYPE='full'
else
 TYPE='incremental'
fi

for DIR in $BDIRS
do
  if [ $DIR = '.' ]; then
    EXCLUDELIST='/usr/local/etc/duplicity-exclude.conf'
  else
    EXCLUDELIST="/usr/local/etc/duplicity-exclude-$DIR.conf"
  fi

  if [ -f $EXCLUDELIST ]; then
    EXCLUDE="--exclude-filelist $EXCLUDELIST"
  else
    EXCLUDE=''
  fi

  # first remove everything older than 2 months
  if [ $DIR = '.' ]; then
   CMD="duplicity remove-older-than 2M -v5 --force $BAC/$TDIR-system >> $LOGDIR/system.log"
  else
   CMD="duplicity remove-older-than 2M -v5 --force $BAC/$TDIR-$DIR >> $LOGDIR/$DIR.log"
  fi
  eval $CMD

  # do a backup
  if [ $DIR = '.' ]; then
    CMD="duplicity $TYPE -v5 $GPGOPT $EXCLUDE / $BAC/$TDIR-system >> $LOGDIR/system.log"
  else
    CMD="duplicity $TYPE -v5 $GPGOPT $EXCLUDE /$DIR $BAC/$TDIR-$DIR >> $LOGDIR/$DIR.log"
  fi
  eval  $CMD

done

# Check the manpage for all available options for Duplicity.
# Unsetting the confidential variables
unset PASSPHRASE
unset FTP_PASSWORD

exit 0

Altes Script:

cat duplicity.sh 
#!/bin/sh
#
# Script created on 17-6-2008
#
# This script was created to make Duplicity backups.
# Full backups are made on the 1st day of each month.
# Then incremental backups are made on the other days.
#
# Quielle: http://wiki.hetzner.de/index.php/Duplicity_Script

# Loading the day of the month in a variable.
date=`date +%d`

# call with parameter 'full' for a full backp

servername="ftp://[xxx].your-backup.de"

# Setting the pass phrase to encrypt the backup files. Will use symmetrical keys in this case.
PASSPHRASE='[password]'
export PASSPHRASE

# Setting the password for the FTP account that the
# backup files will be transferred to.
FTP_PASSWORD='[ftp-pw]'
export FTP_PASSWORD

# Check to see if we're at the first of the month.
# If we are on the 1st day of the month, then run
# a full backup. If not, then run an incremental
# backup.
if [ $date = 01 ] || [ "$1" = full ]
then
duplicity remove-older-than 2M -v5 ${servername}/srv >>/var/log/duplicity/srv.log
duplicity remove-older-than 2M -v5 ${servername}/etc >>/var/log/duplicity/etc.log
duplicity remove-older-than 2M -v5 ${servername}/home >>/var/log/duplicity/home.log
#duplicity remove-older-than 2M -v5 ${servername}/system >>/var/log/duplicity/system.log
duplicity remove-older-than 2M -v5 ${servername}/cyrus >>/var/log/duplicity/cyrus.log
duplicity remove-older-than 2M -v5 ${servername}/www >>/var/log/duplicity/www.log


duplicity full -v5 /srv ${servername}/srv >>/var/log/duplicity/srv.log
duplicity full -v5 /etc ${servername}/etc >>/var/log/duplicity/etc.log
duplicity full -v5 /home ${servername}/home >>/var/log/duplicity/home.log
duplicity full -v5 /var/spool/cyrus ${servername}/cyrus >>/var/log/duplicity/cyrus.log
duplicity full -v5 /var/www ${servername}/www >>/var/log/duplicity/www.log
#duplicity full -v5 --exclude-filelist /etc/duplicityfilelist.conf / ${servername}/system >>/var/log/duplicity/system.log

else
duplicity remove-older-than 2M -v5 ${servername}/srv >>/var/log/duplicity/srv.log
duplicity remove-older-than 2M -v5 ${servername}/etc >>/var/log/duplicity/etc.log
duplicity remove-older-than 2M -v5 ${servername}/home >>/var/log/duplicity/home.log
#duplicity remove-older-than 2M -v5 ${servername}/system >>/var/log/duplicity/system.log
duplicity remove-older-than 2M -v5 ${servername}/cyrus >>/var/log/duplicity/cyrus.log
duplicity remove-older-than 2M -v5 ${servername}/www >>/var/log/duplicity/www.log

duplicity incremental -v5 /srv ${servername}/srv >>/var/log/duplicity/srv.log
duplicity incremental -v5 /etc ${servername}/etc >>/var/log/duplicity/etc.log
duplicity incremental -v5 /home ${servername}/home >>/var/log/duplicity/home.log
duplicity incremental -v5 /var/spool/cyrus ${servername}/cyrus >>/var/log/duplicity/cyrus.log
duplicity incremental -v5 /var/www ${servername}/www >>/var/log/duplicity/www.log
#duplicity incremental -v5 --exclude-filelist /etc/duplicityfilelist.conf / ${servername}/system >>/var/log/duplicity/system.log


fi
# Check http://www.nongnu.org/duplicity/duplicity.1.html
# for all the options available for Duplicity.
# Unsetting the confidential variables so they are
# gone for sure.
unset PASSPHRASE
unset FTP_PASSWORD

exit 0




/etc/duplicityfilelist.conf wuerde etwa so aussehen:

- /dev
- /proc
- /sys
- /tmp
- /etc
- /home
- /srv
- /var/cache
 
Nach oben
backup.txt · Zuletzt geändert: 2024/02/29 13:36 von 127.0.0.1
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp