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: 8,593
Thanks: 44
Thanked 4,487 Times in 1,904 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: 127
Thanks: 64
Thanked 10 Times in 9 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 offline
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 515
Thanks: 123
Thanked 194 Times in 109 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: 127
Thanks: 64
Thanked 10 Times in 9 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 offline
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 515
Thanks: 123
Thanked 194 Times in 109 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: 127
Thanks: 64
Thanked 10 Times in 9 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 offline
Very Senior Member
 
Join Date: Jul 2012
Location: Europe
Posts: 515
Thanks: 123
Thanked 194 Times in 109 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: 127
Thanks: 64
Thanked 10 Times in 9 Posts
huotg01 is just starting out
Default

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

GH
Reply With Quote
  #19  
Old 06-15-2013, 07:23 PM
paulbarrett paulbarrett is offline
New Member
 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
paulbarrett is just starting out
Default

Another good use of rsync is if you want to backup from linux to a usb drive connected to the N66U you can use the following command:

rsync -arv -e ssh --rsync-path=/tmp/mnt/sda1/asusware/bin/rsync /localpath admin@RT-N66U:/tmp/mnt/sda1/

you will of course need to install rsync using "ipkg install rsync" and have ssh running

For cron jobs use a public key or -p "password"
Reply With Quote
  #20  
Old 03-14-2014, 08:23 PM
brusyev brusyev is offline
New Member
 
Join Date: Jul 2013
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
brusyev is just starting out
Default

Quote:
Originally Posted by TeHashX View Post
The following script will mount and sync your nas folder with rsync
First remove previous scripts

Install rsync

Mount and Sync script

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)


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
I am trying to figure out a similar script for my rtn66u but to copy one attached usb drive to another on a daily basis. Both drives are ntfs formated for compatability reasons... I think I first need to make sure that the script first mounts my drives according to their uid's...basically I have two ysb enclosures with raid0 and I would like to mirror one to the other every night....any help with this will be greatly apreciated...
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:01 AM.

Top 10 Stats
Top Posters* Top Thanked
RMerlin  401
stevech  156
thelonelycode...  148
L&LD  126
azazel1024  119
KGB7  86
jim769  80
DrTeeth  69
Adamm  64
speedingcheet...  61
RMerlin  4487
stevech  275
ryzhov_al  199
TeHashX  194
RogerSC  166
L&LD  163
joegreat  105
jlake  102
PrivateJoker  93
sinshiva  88
Most Viewed Threads* Hottest Threads*
Old Asuswrt-Merli...  31950
Old Asuswrt-Merli...  24137
Old ASUS...  22772
Old Beta Version...  17535
Old 'Heartbleed'...  14322
Old Linksys...  9438
Old Potential...  7940
Old Asus-Merlin...  7112
Old Groundhog...  6430
Old Linksys...  5764
Old Asuswrt-Merli...  220
Old Asuswrt-Merli...  179
Old Linksys...  144
Old ASUS...  125
Old Beta Version...  112
Old Potential...  98
Old Linksys...  79
Old Groundhog...  49
Old Asus router...  43
Old USB drive...  39



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