ajout de -info scriptBorg

This commit is contained in:
Didier Denoual 2024-08-16 08:45:49 +02:00
parent c2f02bfb3d
commit a2542d8fea
2 changed files with 16 additions and 5 deletions

View File

@ -8,7 +8,7 @@ _borg()
local current=${COMP_WORDS[COMP_CWORD]} local current=${COMP_WORDS[COMP_CWORD]}
case "$current" in case "$current" in
-*) -*)
local_prop="-h -d -i -l -m -u -t -p -v" local_prop="-h -d -i -l -m -u -t -p -v -info"
COMPREPLY=( $(compgen -W "${local_prop}" -- $current) ) COMPREPLY=( $(compgen -W "${local_prop}" -- $current) )
;; ;;
esac esac

View File

@ -21,7 +21,7 @@ setKazVars
. $DOCKERS_ENV . $DOCKERS_ENV
. $KAZ_ROOT/secret/SetAllPass.sh . $KAZ_ROOT/secret/SetAllPass.sh
VERSION="V-18-05-2024" VERSION="V-16-08-2024"
PRG=$(basename $0) PRG=$(basename $0)
RACINE=$(echo $PRG | awk '{print $1}') RACINE=$(echo $PRG | awk '{print $1}')
#IFS=' ' #IFS=' '
@ -137,9 +137,9 @@ Sauvegarde() {
Purge() { Purge() {
borg prune \ borg prune \
--prefix '{hostname}-' \ --prefix '{hostname}-' \
--keep-daily ${NB_BACKUPS_JOUR} \ --keep-daily=${NB_BACKUPS_JOUR} \
--keep-weekly ${NB_BACKUPS_SEM} \ --keep-weekly=${NB_BACKUPS_SEM} \
--keep-monthly ${NB_BACKUPS_MOIS} \ --keep-monthly=${NB_BACKUPS_MOIS} \
PRUNE_EXIT=$? PRUNE_EXIT=$?
} }
@ -156,6 +156,7 @@ echo "-h : Usage"
echo "-c : Permet de compacter ${BORG_REPO}" echo "-c : Permet de compacter ${BORG_REPO}"
echo "-d : Permet de verifier les variables de sauvegarde" echo "-d : Permet de verifier les variables de sauvegarde"
echo "-i : Mode interractif" echo "-i : Mode interractif"
echo "-info"
echo "-l : Liste les sauvegardes sans monter ${BORG_REPO}" echo "-l : Liste les sauvegardes sans monter ${BORG_REPO}"
echo "-m : Monte le REPO (${BORG_REPO} sur ${BORGMOUNT})" echo "-m : Monte le REPO (${BORG_REPO} sur ${BORGMOUNT})"
echo "-p : Permet de lancer la phase de purge des backup en fonctions des variables: jour=${NB_BACKUPS_JOUR},semaine=${NB_BACKUPS_SEM},mois=${NB_BACKUPS_MOIS}" echo "-p : Permet de lancer la phase de purge des backup en fonctions des variables: jour=${NB_BACKUPS_JOUR},semaine=${NB_BACKUPS_SEM},mois=${NB_BACKUPS_MOIS}"
@ -215,6 +216,11 @@ Borglist() {
exit exit
} }
Borginfo() {
LogFic "Borg info demandé"
borg info ${BORG_REPO}
exit
}
main() { main() {
# ****************************************************** Main ******************************************************************* # ****************************************************** Main *******************************************************************
@ -378,6 +384,11 @@ for ARG in $@; do
[[ ${READPURGE} =~ ^[oO]$ ]] && Purge || echo "pas de purge" [[ ${READPURGE} =~ ^[oO]$ ]] && Purge || echo "pas de purge"
exit exit
;; ;;
'-info' )
shift
Borginfo
exit
;;
* | ' ' ) * | ' ' )
usage usage
;; ;;