From 6bace1cfbb86d939238d47937e4342be15b17a4d Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Thu, 28 Feb 2013 06:52:08 +0100 Subject: [PATCH] =?UTF-8?q?=C3=87a=20tra=C3=AEnait.=20=C3=87a=20avait=20l'?= =?UTF-8?q?air=20cool.=20J'ai=20git=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackupPC_GetTarBackup.sh | 37 +++++++++++++++++++++++++++++++++++++ utils/delete_ldap_log.sh | 11 +++++++++++ 2 files changed, 48 insertions(+) create mode 100755 BackupPC_GetTarBackup.sh create mode 100755 utils/delete_ldap_log.sh diff --git a/BackupPC_GetTarBackup.sh b/BackupPC_GetTarBackup.sh new file mode 100755 index 00000000..f7d28fc3 --- /dev/null +++ b/BackupPC_GetTarBackup.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# La syntaxe de BackupPC_tarCreate est un peu chiante... Ce wrapper facilite le travail pour extraire une sauvegarde +# NS. 18 juin 2005 + +host=$1 +shareName=$2 +Destdir=$3 +AddPath=$4 +args=$# + +CheckHost() { + test -f /var/lib/backuppc/pc/$host/backups || { echo "No backups for host $host !" ; exit 1 ; } + LastBackup=$(tail -1 /var/lib/backuppc/pc/$host/backups | cut -f 1) +} + +CheckDestDir() { + if [ "$Destdir" != "" ] ; then + test -d $Destdir || { echo "Destination directory not found !" ; exit 1 ; } + Destdir="$Destdir/" + fi +} + +Usage() { + if [ $args -lt 2 ] ; then + echo "Usage: $0 host shareName [Destdir] [AddPath]" >&2 + exit 1 + fi +} + +Usage +CheckHost +CheckDestDir +#echo Last backup for $1 is number $LastBackup + +/bin/su backuppc -c "/usr/share/backuppc/bin/BackupPC_tarCreate -h $host -n $LastBackup -s $shareName -r / -p $AddPath/ . > ${Destdir}${host}.${shareName}.tar" + diff --git a/utils/delete_ldap_log.sh b/utils/delete_ldap_log.sh new file mode 100755 index 00000000..754a68e3 --- /dev/null +++ b/utils/delete_ldap_log.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Petit script pour réduire la place prise par les anciens logs +# de ldap qui ne sont plus utilisés + +STORE=/var/lib/ldap + +for f in `db4.8_archive -h $STORE`; do + echo Removing $f ... + rm -f $STORE/$f +done +