From: Bastian Dehn Date: Mon, 16 Jul 2018 17:38:27 +0000 (+0200) Subject: change: backup with long parameter X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=f4e7e19563e8f79fe4392ac68b2f7cfc588f2c91;p=simple-backup.git change: backup with long parameter --- diff --git a/backup b/backup index a45fc33..2bda90e 100755 --- a/backup +++ b/backup @@ -28,7 +28,7 @@ ReadArguments() CreateBackupFolder() { backDir="$(date +%Y-%m-%d)"_"$backname" - lastBackDir="$(date -d "1 Day ago" +%Y-%m-%d)"_"$backname" + lastBackDir="$(date --date="1 Day ago" +%Y-%m-%d)"_"$backname" if [ ! -d $backpath/$lastBackDir ]; then tmpordner=$(find $backpath -maxdepth 1 -type d \ @@ -88,12 +88,13 @@ BackupVMDiscs() elif [ "$DiskType" == "block" ]; then local readonly DiskName=$(echo $Disk \ | sed 's/^\///' | sed 's/\//-/g') - local readonly DiskSize=$(ssh $remoteLogin fdisk -l $Disk \ - | head -n 1 | awk -F "," '{print $2}' \ + local readonly DiskSize=$(ssh $remoteLogin fdisk --list \ + $Disk | head --lines=1 | awk \ + --field-separator="," '{print $2}' \ | sed 's/[ \| Bbytes]//g') ssh $remoteLogin dd bs=1M if=$Disk \ - | pv -s $DiskSize | gzip -c \ + | pv --size $DiskSize | gzip --stdout \ | dd of=$backRemotePCPath/$DiskName.gz fi done @@ -220,7 +221,7 @@ CleanUpBackups() printf "Es sind %i Sicherungen vorhanden.\n" $backupanzahl printf "Es werden %i Sicherungen gelöscht.\n\n" $loeschanzahl - ls -d $backpath/*/ \ + ls --directory $backpath/*/ \ | grep "_$backname" --max-count=$loeschanzahl \ | xargs rm --recursive