mr-manuel / raspberry-pi-backup

This script allows you to backup your Raspberry Pi to a SMB/CIFS share on a NAS/computer without removing the SD card.
MIT License
30 stars 4 forks source link

Error message on deleting non-existing old backups #4

Closed herrfrei closed 1 year ago

herrfrei commented 1 year ago

Hi, I tried your backup script right now for the first - many thanks for it! Of course, I have no old backup on the mounted drive. I got the following output:

root@raspberrypi2:~# /data/etc/raspberry-pi-backup/backup.sh

Mounting "//XXXXXXXX/backup" to "/mnt/backup"...

Creating "venus/" on backup mount...

Using script dd for backup.
15804000000 bytes (16 GB, 15 GiB) copied, 1343 s, 11.8 MB/s
15812+1 records in
15812+1 records out
15812526080 bytes (16 GB, 15 GiB) copied, 1354.37 s, 11.7 MB/s
Backup completed successfully.

head: invalid number '-5'
ls: /mnt/backup/venus/raspberrypi2/Backup_raspberrypi2_20231106_182638.img: Value too large for defined data type

It's clear that this comes from the line

BACKUP_FILES_TO_DELETE_COUNT=$(ls -tr ${BACKUP_PATH}/${BACKUP_NAME}* | head -n -${BACKUP_COUNT} | wc -l)

but I have no idea why.

mr-manuel commented 1 year ago

It was a typo. I fixed it. Could you download the script from the master branch and test again?