Commit 3bf3b10d authored by Simone Piccardi's avatar Simone Piccardi
Browse files

Correzioni varie

parent 7ce1f91d
......@@ -39,7 +39,6 @@
LC_ALL=C
umask 077
# define exit function (sending email)
mail_exit () {
if [ $1 != 0 ]; then
......@@ -78,7 +77,7 @@ echo
if [ -f /etc/fuss-backup/fuss-backup.conf ]; then
. /etc/fuss-backup/fuss-backup.conf
else
echo "Errore: file di configurazione non presente"
echo "Errore: file di configurazione /etc/fuss-backup/fuss-backup.conf non presente"
mail_exit 1
fi
......@@ -87,6 +86,7 @@ if [ $START != "yes" ]; then
echo "ERRORE: è necessario configurare l'applicazione fuss-backup"
echo "per avviarne l'esecuzione!"
echo "Modificare il file /etc/fuss-backup/fuss-backup.conf"
echo "per definire START=yes"
mail_exit 2
fi
......@@ -138,7 +138,6 @@ if which slapd > /dev/null; then
# dump data with slapcat
slapcat | $GZ > $FILEBACK
echo "* slapcat dump in $FILEBACK"
tranfencrypt $FILEBACK
# clean old (more than MAXDAYS) copies, leaving at least MINCOPIES
if [ $(ls $NAME* | wc -l) -gt $MINCOPIES ]; then
find . -name "${NAME}*" -mtime $MAXDAYS -exec rm -f \{\} \;
......@@ -179,7 +178,6 @@ if which mysqld_safe > /dev/null; then
mysqldump ${i} --events --user=$DBUSER | $GZ > $FILEBACK 2>> $ERRLOG
grep -v information_schema $ERRLOG >>$TMPLOG
echo "* database ${i} dumped in $FILEBACK"
tranfencrypt $FILEBACK
if [ $(ls ${i}-*.sql.gz|wc -l) -gt $MINCOPIES ]; then
find . -name "${i}-*.sql.gz" -mtime +$MAXDAYS -exec rm -f \{\} \;
fi
......@@ -193,7 +191,6 @@ if which mysqld_safe > /dev/null; then
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' \
> $DUMPFILE
echo "* dumped MySQL grants in $DUMPFILE"
tranfencrypt $DUMPFILE
echo "MySQL dump completed at $(date +%R)"
fi
......@@ -218,13 +215,17 @@ fi
#
if [ ! $DISK ]; then
echo "Deve essere definito il disco/NAS di destinazione"
echo "Modificare il file /etc/fuss-backup/fuss-backup.conf"
echo "per definire un opportuno valore della variabile DISK"
mail_exit 3
fi
umount $BASEDIR 2> /dev/null
# define borg backup destination
DESTINATION=$BASEDIR/$BACKUP_DIR
if mount $DISK $BASEDIR; then
DESTINATION=$BASEDIR/$BACKUP_DIR
# init backup repository if no exists
if [ ! -d $DESTINATION ]; then
borg init --encryption=none $DESTINATION
......@@ -239,10 +240,10 @@ if mount $DISK $BASEDIR; then
$DESTINATION::{hostname}-{now:%Y-%m-%dT%H:%M:%S} $PATHS
fi
# enforce data retention
borg prune --keep-daily $STORICO
borg prune --keep-daily $RETENTION $DESTINATION
umount $BASEDIR
else
echo "Failed to mount backup disk"
echo "Failed to mount backup device $DISK"
mail_exit 4
fi
......
......@@ -8,18 +8,21 @@ START=no
# quanti giorni dei backup vecchi vengono mantenuti, passato
# all'opzione -d di borg (costituisce anche il numero minimo di backup
# che restano in archivio (default 7, il programma deduplica)
STORICO=7
RETENTION=7
# disco del backup (montato prima di eseguire borg), nel caso di NFS
# va specificato nella forma IP:directory
DISK=""
# Base directory for mount
# Base per i mount
BASEDIR=/mnt
# Backup directory (sul disco montato)
BACKUP_DIR=borgdata
# Directory per i ripristini (ci viene montato via fuse il backup)
BORGRECOVER=borgrecover
# List of directory put in the backup
PATHS="/etc /home /var/backups /var/lib /var/log /var/mail /var/local"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment