Difference between revisions of "Raspian Backup over NFS with mount point check"
Jump to navigation
Jump to search
(Created page with "setup : Raspian Debian OS with 2 raspberry pi's and one USB DISK * create a Backup Script with: <pre> nano /root/firmware-dd.sh </pre> enter: <pre> #!/bin/bash date=`/bin/dat...") |
|||
Line 26: | Line 26: | ||
Remark: The Script mount the USBDISK on the other 2nd. raspberry pi which is exported via NFS | Remark: The Script mount the USBDISK on the other 2nd. raspberry pi which is exported via NFS | ||
and the mount check exit the script if the NFS Share is offline or broken! If ok the Firmware | and the mount check exit the script if the NFS Share is offline or broken! If ok the Firmware | ||
− | is dumped to the NFS USB | + | is dumped to the NFS USB Disk. |
run it on root crontab every week: | run it on root crontab every week: |
Latest revision as of 03:29, 4 November 2017
setup : Raspian Debian OS with 2 raspberry pi's and one USB DISK
- create a Backup Script with:
nano /root/firmware-dd.sh
enter:
#!/bin/bash date=`/bin/date +%Y%m%d-%H%M%S` hostname=`/bin/hostname` mount -t nfs XXX.XXX.XXX.XXX:/usbdisk /mnt -o soft,nolock,rsize=4096,wsize=4096 if ! grep /mnt /proc/mounts > /dev/null 2>&1; then umount /mnt && exit 0 fi cd /mnt/Firmwares dd if=/dev/mmcblk0 of=$hostname-$date.img bs=1M sleep 2 sync sync cd / umount /mnt exit 0
Remark: The Script mount the USBDISK on the other 2nd. raspberry pi which is exported via NFS and the mount check exit the script if the NFS Share is offline or broken! If ok the Firmware is dumped to the NFS USB Disk.
run it on root crontab every week:
@weekly sh /root/firmware-dd.sh > /dev/null 2>&1
Check weeky the output!