Solved

Rsync progress question

Posted on 2013-01-28
8
620 Views
Last Modified: 2013-01-31
I’m backing up my VM’s from my storage server to external HDD for offsite backup.  I’m trying to monitor how the progress is going, but despite what appears to be the right parameter, I’m not seeing it.  I’ve created a script with a command for each of the dirs that uses a supplied parameter (the date stamp on the backup dir) for each directory.  At the end I want it to shoot me an email.  My command is called backup.sh.  I’m running it as root, sh backup.sh 2013-01-25_04-00-00

The backup.sh looks like this inside:

rsync -r -v --progress /mnt/storage/nfs/ocl_nfs_1/backups/server1/server1-$1 /media/external/server1 | mail -s "RSync Job Log" iamhere@work.ca

(more server backups follow this one, each using the same command with the names changed.)

I’m sure there’s a better way to do this.  I’m running this on Openfiler 2.99 2.6.32-131.17.1.el6-0.11.smp.gcc4.4.x86_64.  (based on rPath)

also, if there's a faster way to transfer to a USB device other than Rynsc that will still mail me a log when completed I'd appreciate any additional input.
0
Comment
Question by:clicker666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 38829743
Way outside the scope of this question:
If you moved to a zfs based storage (zfsguru.com is what I recommend but there are others) you can make snapshots and send them to another zfs box. For non zfs stuff you can rsync with snapshots like so:
http://forums.freebsd.org/showthread.php?t=11971

Just something I mention to people running NSF shares on non-zfs storage like openfiler.
0
 
LVL 1

Author Comment

by:clicker666
ID: 38830608
I found my own answer.  This parameter seems to break the onscreen progress indicators.   | mail -s "RSync Job Log" iamhere@work.ca  Since it wasn't actually sending me email I suppose I can live without it for now.
0
 
LVL 1

Author Comment

by:clicker666
ID: 38837246
I've requested that this question be closed as follows:

Accepted answer: 0 points for clicker666's comment #a38830608

for the following reason:

Although I fixed my own problem, it stops me from receiving email logs of the jobs.  I will have to research and revisit that side - but for now I will manually run the jobs and monitor their progress.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 20

Expert Comment

by:Daniel McAllister
ID: 38835262
Sorry I came late to this one... hope I'm not too late...

Your issue is that you want the output to go both to the screen and to the mail program.

At first glance, I'd suggest using the 'tee' utility (reads standard in, sends a copy to stdout, and another copy to a specified file).... but I don't think that will work, as the real "break" comes from the fact that your output is being directed to a pipe at all.

Still, without having a system to try it on, I might suggest something like:
rsync -r -v --progress /mnt/storage/nfs/ocl_nfs_1/backups/server1/server1-$1 /media/external/server1 | tee /tmp/mailout.tmp ; mail -s "RSync Job Log" iamhere@work.ca < /tmp/mailout.tmp

This would allow the interactive output to the screen, while still capturing it for output to the mail program.

Just a thought...

Dan
IT4SOHO

PS: I won't object to just closing the question ... but if the solution works, it would be sporting to award points :-)
0
 
LVL 1

Author Comment

by:clicker666
ID: 38836533
IT4SOHO almost has it.  Can we reopen?

That does send me an email when done, the only issue is that it comes in as Subject: RSync Job Log, but the attachment gets renamed as RSync Job Log.dat.  Is there a way to specify the attachment name in the command line?  It's almost perfect.
0
 
LVL 20

Expert Comment

by:Daniel McAllister
ID: 38837247
I can stop the cancellation request....

Dan
IT4SOHO
0
 
LVL 20

Accepted Solution

by:
Daniel McAllister earned 250 total points
ID: 38837290
Hmmm... I'm actually a little surprised that the e-mail content is showing up as an attachment...

Perhaps if we "seed the file" a little (that is, create some interesting first lines)...

Try something like:
echo "" > /tmp/mailout.tmp
echo "Starting backup with rsync at `date +"%r %Z"` >> /tmp/mailout.tmp
rsync -r -v --progress /mnt/storage/nfs/ocl_nfs_1/backups/server1/server1-$1 /media/external/server1 | tee -a /tmp/mailout.tmp
echo "" >> /tmp/mailout.tmp
mail -s "RSync Job Log" iamhere@work.ca < /tmp/mailout.tmp

Once you get this working, you may want to remove the /tmp file at the end :-)

Dan
IT4SOHO
0
 
LVL 1

Author Comment

by:clicker666
ID: 38839483
That works.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
Microsoft will be releasing the Windows 10 Creators Update in just a matter of weeks. Are you prepared? Follow these steps to ensure everything goes smoothly and you don't lose valuable data on your PC.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question