The following script will mount and sync your nas folder with
rsync
First remove previous scripts
Quote:
rm jffs/scripts/backup-usbtonas.sh
rm jffs/scripts/init-start
mkdir /mnt/ENTWARE/nas
chmod 777 /mnt/ENTWARE/nas
|
Install rsync
Mount and Sync script
Quote:
echo "#!/bin/sh" > /jffs/scripts/sync-usbtonas.sh
echo "mount -t cifs \\\\\\\\192.168.1.100\\\\nasfolder /mnt/ENTWARE/nas -o \"username=nas_username,password=nas_password\"" >> /jffs/scripts/sync-usbtonas.sh
echo "sleep 10" >> /jffs/scripts/sync-usbtonas.sh
echo "rsync -r -v -u -s /mnt/ENTWARE/usb_folder_to_sync /mnt/ENTWARE/nas/" >> /jffs/scripts/sync-usbtonas.sh
chmod a+rx /jffs/scripts/sync-usbtonas.sh
|
This script will schedule a cron job to run every saturday at 03:00 AM (if you want to change time, use
this cron job generator)
Quote:
echo "#!/bin/sh" > /jffs/scripts/init-start
echo "cru a SyncUsbToNas \"0 3 * * 6 /jffs/scripts/sync-usbtonas.sh\"" >> /jffs/scripts/init-start
chmod a+rx /jffs/scripts/init-start
|
Like usual, change the values in
red
Anyway, the only difference with this method is that rsync will copy only the new files in
usbfolder and not all like with ''cp -r'' command, now depends on you what do you need.
Test with
Quote:
|
rsync -r -v -u --progress -s /mnt/ENTWARE/usb_folder_to_sync /mnt/ENTWARE/nas/
|