SmallNetBuilder Forums

Go Back   SmallNetBuilder Forums > Wireless Networking > ASUS Wireless > Asuswrt-Merlin

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old 02-10-2013, 01:58 PM
RMerlin's Avatar
RMerlin RMerlin is offline
Very Senior Member
 
Join Date: Apr 2012
Location: Canada
Posts: 3,644
Thanks: 27
Thanked 1,585 Times in 772 Posts
RMerlin is just starting out
Default

And don't forget rsync - invaluable if your ultimate goal is to push backups of a folder to a share.
__________________
Asuswrt-Merlin: Customized firmware for Asus routers
Github: github.com/RMerl - Twitter: RMerlinDev
See the sticky post for more info.
Reply With Quote
  #12  
Old 02-10-2013, 08:45 PM
huotg01's Avatar
huotg01 huotg01 is offline
Senior Member
 
Join Date: Feb 2013
Posts: 123
Thanks: 58
Thanked 8 Times in 7 Posts
huotg01 is just starting out
Default

Quote:
Originally Posted by TeHashX View Post
So, you need to copy a file or a folder from usb drive to your nas?
First we need to make a test
...
If is ok, we just need to create a script and a cron job to automatically schedule the transfer.
Just give more detail what kind of files you want to copy
The copy works well.
Quote:
Originally Posted by RMerlin View Post
And don't forget rsync - invaluable if your ultimate goal is to push backups of a folder to a share.
Good point. The goal is to backup weekly a folder on the router usb disk to a share on the NAS.

Thanks,

GH
Reply With Quote
  #13  
Old 02-11-2013, 05:06 AM
TeHashX's Avatar
TeHashX TeHashX is online now
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 264
Thanks: 66
Thanked 88 Times in 55 Posts
TeHashX is just starting out
Default

Your nas is always on?
Reply With Quote
  #14  
Old 02-11-2013, 06:43 AM
huotg01's Avatar
huotg01 huotg01 is offline
Senior Member
 
Join Date: Feb 2013
Posts: 123
Thanks: 58
Thanked 8 Times in 7 Posts
huotg01 is just starting out
Default

Quote:
Originally Posted by TeHashX View Post
Your nas is always on?
Yes.

Envoyé depuis mon SGH-I717D avec Tapatalk
__________________
GH
RT-N66U with RMerlin's FW
ps: don't take my "senior member" title too seriously...
Reply With Quote
  #15  
Old 02-11-2013, 06:58 AM
TeHashX's Avatar
TeHashX TeHashX is online now
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 264
Thanks: 66
Thanked 88 Times in 55 Posts
TeHashX is just starting out
Default

I never used rsync, I have to read about it.
The following script will mount and copy your nas folder
Quote:
echo "#!/bin/sh" > /jffs/scripts/backup-usbtonas.sh
echo "mount -t cifs \\\\\\\\192.168.1.100\\\\nasfolder /mnt/ENTWARE/nas -o \"username=nas_username,password=nas_password\"" >> /jffs/scripts/backup-usbtonas.sh
echo "sleep 10" >> /jffs/scripts/backup-usbtonas.sh
echo "cp -r /mnt/ENTWARE/usb_folder_to_backup /mnt/ENTWARE/nas/" >> /jffs/scripts/backup-usbtonas.sh
chmod a+rx /jffs/scripts/backup-usbtonas.sh
This script will schedule a cron job to run every saturday at 03:00 AM (if you want to change time, have a look here)
Quote:
echo "#!/bin/sh" > /jffs/scripts/init-start
echo "cru a BackupUsbToNas \"0 3 * * 6 /jffs/scripts/backup-usbtonas.sh\"" >> /jffs/scripts/init-start
chmod a+rx /jffs/scripts/init-start
Quote:
reboot
It seams a little bit complicated until I figure out how rsync works but don't forget to change the values in red and do a test with this command:
# /jffs/scripts/backup-usbtonas.sh
Reply With Quote
The Following User Says Thank You to TeHashX For This Useful Post:
  #16  
Old 02-11-2013, 11:48 AM
huotg01's Avatar
huotg01 huotg01 is offline
Senior Member
 
Join Date: Feb 2013
Posts: 123
Thanks: 58
Thanked 8 Times in 7 Posts
huotg01 is just starting out
Default Rsync

Quote:
Originally Posted by TeHashX View Post
I never used rsync, I have to read about it.
You have taught me so much in this thread. Thank you very much for your guidance.

Being where we are now, here are some links that could shorter the rsync learning curve:
GH
Reply With Quote
  #17  
Old 02-18-2013, 10:39 AM
TeHashX's Avatar
TeHashX TeHashX is online now
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 264
Thanks: 66
Thanked 88 Times in 55 Posts
TeHashX is just starting out
Default

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
Quote:
opkg 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
Quote:
reboot
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/

Last edited by TeHashX; 02-18-2013 at 10:42 AM.
Reply With Quote
The Following User Says Thank You to TeHashX For This Useful Post:
  #18  
Old 02-18-2013, 10:59 AM
huotg01's Avatar
huotg01 huotg01 is offline
Senior Member
 
Join Date: Feb 2013
Posts: 123
Thanks: 58
Thanked 8 Times in 7 Posts
huotg01 is just starting out
Default

Thanks TeHashX. What a job!
I will try that and come back here.

GH
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 07:15 AM.

Top 10 Stats
Top Posters* Top Thanked
RMerlin  316
coxhaus  119
stevech  112
Fraoch  45
vdemarco  41
tipstir  38
RogerSC  32
Mark Uhde  28
CaptainSTX  27
TeHashX  26
RMerlin  1585
stevech  145
ryzhov_al  104
TeHashX  88
RogerSC  71
GregN  54
Geraner  44
CL-Jeremy  42
joegreat  39
sfx2000  34
Most Viewed Threads* Hottest Threads*
Old Asuswrt-Merli...  6718
Old Asuswrt-Merli...  3364
Old 2GHz...  1688
Old IPv6 not...  1677
Old Article...  1427
Old FlexRaid on...  1324
Old Does...  1306
Old RT-N66U...  1290
Old AC 5ghz...  1194
Old DLNA Media...  1178
Old Asuswrt-Merli...  67
Old IPv6 not...  44
Old Asuswrt-Merli...  42
Old Two DHCP...  28
Old DLNA Media...  22
Old BW logs not...  20
Old Inaccuracy -...  19
Old RT-N66U...  19
Old Information...  18
Old How to...  18





Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
© 2006-2013 Pudai LLC All Rights Reserved.