GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:
It works just fine. Doing something similar for rsync:open ( CRON, "ssh host crontab -l" ) || die $!; while ( <CRON> ) { print $_; }
The rsync command will only print out something when it doesn't work properly. In this case, I actually store it and do something w/ it later. What I've found though, is that when I run the script, it is spitting the output out on the terminal... not being captured in the file handle. I assume ssh is printing to stdout and rsync to something else, but I thought Perl would capture any output, if I open a command as a file handle.open ( RSYNC, "rsync -az -e \"ssh -o BatchMode=yes\" --delete-after ho +st:/path/to/dir /path/to/backup |" ); while ( <RSYNC> ) { print "output: $_"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filehandle not reading
by graff (Chancellor) on Mar 05, 2007 at 03:09 UTC | |
by blazar (Canon) on Mar 05, 2007 at 09:22 UTC | |
by GaijinPunch (Pilgrim) on Mar 05, 2007 at 03:17 UTC |