ReadyNAS Rsync Backup with Options
I am doing more backups for clients these days. One issue I ran into was that the ReadyNAS’s web user interface does not provide many options for how an rsync job runs. For example, while you can control whether or not files are deleted on the remote machine, you can not control most other standard options. I needed to specify two options:
1) I needed rsync to run on an alternate port so that I could map that port to the right backup readynas machine at my home office (I have more than one now). Without the ability to specify ports I had no way to target the correct readynas machine behind my office firewall. Well, there are ways, but VPN and SSH solutions were not exactly what I wanted. I just wanted to specify –port=XXXX
2) I needed to constrict how much bandwidth the rsync backups could use. This was mostly because my clients have slower internet connections than I do and if I let rsync just run, it would eat up all the upload bandwidth at my client’s location (if the job ran late). While there are some controls for this in the QOS settings in the router at my client’s location (running DD-WRT), I thought the rsync option would work just fine. I just needed to be able to specify –bwlimit=50
I looked around a lot for a solution but could not find one. I even called Netgear and their support team did a great job understanding the issue and thinking about solutions with me. But in the end they admited they had no Web UI solution and that getting access to the unix shell and setting up a job in CRON was the only solution. So I set up a job in CRON and it has been running for several weeks without issue. Basically it is just a small shell script with a bunch of rsync jobs that run daily.
But my shell script was just adequate. I am not a unix programmer so some of the more complex things I wanted from my backup job were not in my dinky script. I did have it email me when it was complete, but I never new if it completed properly unless I manually looked at the logs each day (which I didn’t). And I had nothing in my script to prevent another backup from starting even if the previous day’s backup was still running…a real possibility. From looking at the backup jobs built into the readynas, I could see how they provided these and other options, but I did not fully understand how to add them to my script so I didn’t.
Then today I happened to stumble upon Ian Macdonald’s post about how he added a little PERL code to the ReadyNAS’s backup script generator (it generates the shell script that actually performs the backup). This addition let’s you use the ReadyNAS web UI to create jobs as you normally would. But when the jobs are executed, his perl script additions do a lookup in an external file to see what options to apply! Bingo!!
His code was fairly simple. It looked for a config file called /frontview/conf/rsync.conf. In that file his perl code would look for a matching source or destination for the job in question and apply options. Simple enough. The only downside (minor) is that the TEST CONNECTION button in the web UI does not use these options. So for me, connecting on a different port, I could not use the test button. No biggee….this is just a small inconvenience.
Now I can create jobs in the web UI and be assured that jobs will only run one at a time and also provide emails with the logs when they complete. And I have full control over what rsync options I want the jobs to run with. Cool!
No commentsNo comments yet. Be the first.
Leave a reply

