#!/bin/bash set -eu synopsis() { cat << EOF Usage : `basename $0` [-h] system EOF } help() { cat << EOF `basename $0` gestion des sauvegardes des systèmes. `synopsis` -h : affiche cette aide EOF } usage() { synopsis exit 1 } args() { local opt while getopts "h" opt; do case $opt in h) help; exit 0;; ?) usage;; esac done shift $(($OPTIND - 1)) [ $# -ne 0 ] && usage return 0 } manage() { L=$(find $SAVE_PATH -type f -ls | sort -n -k 2 | tr -s ' ' | cut -d ' ' -f 12) [ -z "$L" ] && { echo "Aucune sauvegarde !" >&2; sleep 3; exit 0; } || : for i in $L; do du -h $i; done echo echo "total : $(du -sh $SAVE_PATH)" echo [ -x /usr/bin/quota ] && { quota -v; echo; } || : echo "Remarques :" echo echo "pour retrouver l'aspect creux d'un fichier cow :" echo "virt-sparsify --in-place fichier.cow" echo echo "pour inspecter le contenu d'une archive tgz :" echo "tar tvf fichier.tgz" echo echo "Pour supprimer un fichier :" echo "rm fichier" echo #echo "Tapez exit (ou CTRL D) pour quitter ce shell" #echo #cd /tmp; PS1="exit (or CTRL D) to quit $ " bash --noprofile --norc -i #/bin/bash } # Programme principal VDN_PATH=$(readlink -f $(dirname $0)/..); . $VDN_PATH/bin/functions.sh args "$@" #set -x manage