Skip to content

Commit 335e46b

Browse files
Update 2023-06-16-back-up-rpi-live.md
1 parent 154dc3b commit 335e46b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

_posts/2023-06-16-back-up-rpi-live.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ sudo nano /root/.local/bin/backup
7575
#!/bin/bash
7676

7777
# Backup RPI
78-
image-backup --initial /mnt/backup/rpi1_$(date +%Y-%m-%d).img,,5000
78+
image-backup --initial /mnt/backup/rpi_$(date +%Y%m%d_%H%M%S).img,,5000
79+
80+
# Prune backups
81+
prune --path /mnt/backup/ --ext img --keep-daily 7 --keep-weekly 4 --keep-monthly 2
7982
```
8083

81-
Then you'll have to add the following to the root crontab as we want the root user to run the backup. Because we put our image-util files in `/usr/local/sbin` we'll have to define that in the crontab path.
84+
This also [uses prune](https://binarypatrick.dev/posts/using-prune-to-manage-archives/) to ensure we don't run out of storage. Then you'll have to add the following to the root crontab as we want the root user to run the backup. Because we put our image-util files in `/usr/local/sbin` we'll have to define that in the crontab path.
8285

8386
```bash
8487
sudo crontab -e

0 commit comments

Comments
 (0)