840 bytes added
, 03:28, 4 November 2017
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/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
</pre>
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 Drisk.
run it on root crontab every week:
<pre>
@weekly sh /root/firmware-dd.sh > /dev/null 2>&1
</pre>
Check weeky the output!