Link to home
Start Free TrialLog in
Avatar of clicker666
clicker666

asked on

Rsync progress question

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.
Avatar of Aaron Tomosky
Aaron Tomosky
Flag of United States of America image

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.
Avatar of clicker666
clicker666

ASKER

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.
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.
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 :-)
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.
I can stop the cancellation request....

Dan
IT4SOHO
ASKER CERTIFIED SOLUTION
Avatar of Daniel McAllister
Daniel McAllister
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That works.