瀏覽代碼

añado soporte para argumento de dias a borrar

pull/1/head
Pablo Sarria 7 年之前
父節點
當前提交
28378ec31f
共有 1 個檔案被更改,包括 11 行新增4 行删除
  1. +11
    -4
      zonebackuptofile.sh

+ 11
- 4
zonebackuptofile.sh 查看文件

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

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

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

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

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

RUTADESTINO="/zones/tools/mounts"
@@ -47,8 +54,8 @@ if [ $? != 0 ]; then
exit
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()
{


Loading…
取消
儲存