Przeglądaj źródła

añado soporte para argumento de dias a borrar

pull/1/head
Pablo Sarria 7 lat temu
rodzic
commit
28378ec31f
1 zmienionych plików z 11 dodań i 4 usunięć
  1. +11
    -4
      zonebackuptofile.sh

+ 11
- 4
zonebackuptofile.sh Wyświetl plik

@@ -2,16 +2,19 @@


usage() usage()
{ {
echo "Usage: $0 -z UUID" >&2
echo "Usage: $0 -z UUID -d days" >&2
exit 1 exit 1
} }


while getopts "z:" opt;
while getopts "z:d:" opt;
do do
case "$opt" in case "$opt" in
z) z)
UUID=$OPTARG UUID=$OPTARG
;; ;;
d)
DAYS=$OPTARG
;;
*) *)
usage usage
;; ;;
@@ -24,6 +27,10 @@ if [ -z "${UUID}" ]; then
usage usage
fi fi


if [ -z "${DAYS}" ]; then
usage
fi

BRAND=`/usr/sbin/vmadm get $UUID | json brand | tr -d '\n'` BRAND=`/usr/sbin/vmadm get $UUID | json brand | tr -d '\n'`


RUTADESTINO="/zones/tools/mounts" RUTADESTINO="/zones/tools/mounts"
@@ -47,8 +54,8 @@ if [ $? != 0 ]; then
exit exit
fi fi


# mantenemos los backups de los ultimos dos dias
find $RUTADESTINO/$UUID -type f -mtime +3 -delete
# mantain backups of the last N days
find $RUTADESTINO/$UUID -type f -mtime +$DAYS -delete


snapshot() snapshot()
{ {


Ładowanie…
Anuluj
Zapisz