Add backup script for raspberry pi sd card
[dotfiles/scripts.git] / pi_backup
1 #!/bin/sh
2
3 BACKUP_DIR="/media/usb/pi_backup"
4
5 if [ -w $BACKUP_DIR ]; then
6     dd if=/dev/mmcblk0 bs=4M | gzip > $BACKUP_DIR/pi-backup_$(date +"%y%m%d").img.gz
7     find $BACKUP_DIR -type f -name pi-backup_\*.img.gz -ctime +3 -exec rm \-f {} \;
8 fi