Jeffrey Young
Very Senior Member
Share with us!
You will need to install rsync (make sure you have entware installed as well.
From a ssh shell run
Code:
opkg install rsync
I then have this script in /jffs/scripts. Called ImageUSB
Code:
#!/bin/sh
if [ ! -d /tmp/mnt/WDCloud ]
then
mkdir /tmp/mnt/WDCloud
chmod 777 /tmp/mnt/WDCloud
fi
mount -t cifs \\\\192.168.0.14\\Router /tmp/mnt/WDCloud -o "username=router,password=password"
sleep 10
if [ -n "`mount | grep /tmp/mnt/WDCloud`" ]; then
rsync -r -q -u -s --exclude 'myswap.swp' /tmp/mnt/Router/* /tmp/mnt/WDCloud/USBKey/
rsync -r -q -u -s /jffs/* /tmp/mnt/WDCloud/jffs/
umount /tmp/mnt/WDCloud
fi
Lastly, in your /jffs/scripts/init-start script, add
Code:
cru a SyncUsbToNas "0 3 * * * /jffs/scripts/ImageUSB"
You will need to modify things for your environment as well as having the proper account on your NAS or where ever you are sending the backup. I had said that the script runs at midnight, but looking at the cron job add line, it runs at 3 am everyday.