Capturing output

Max Bowsher maxb at ukf.net
Wed Mar 5 05:41:17 EST 2003


Tom Freeman wrote:
> Hi folks,
> I am running rsync via a perl script run in a cronjob.
> 
> Here's the command i'm running
> 
> my $message = `/usr/bin/rsync --rsh=/usr/local/openssh/bin/ssh -avu
> $directory $destination`;
> 
> At the moment when I run the script it writes all output to the
> screen. I want to be able to write this data
> to a log file, so that if things don't work, I can find out what's
> wrong. 
> 
> I've tried
> &writeLog("$message");
> but this misses out some of the stuff that rsync writes to the
> screen, i.e. the useful stuff actually, like if the file is not found
> on the machine. 
> 
> Any ideas how I can achieve this? Or is this a perl type question
> rather than something I can do with rsync...?

Yes, this is a perl question, not an rsync question. 
Do "perldoc perlop" and search for `STRING` (including the backticks).

Max.



More information about the rsync mailing list