On 12/24/05, <b class="gmail_sendername">Madison Kelly</b> <<a href="mailto:linux-5ZoueyuiTZhBDgjK7y7TUQ@public.gmane.org">linux-5ZoueyuiTZhBDgjK7y7TUQ@public.gmane.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br><br>   Is there a module that lets you call a system application (ie: rsync)<br>and then watch it's status? I need to find a way to start a system<br>program and then reliably report on it's status every # seconds.
</blockquote><div><br>
When I use rsync, I use 'vv' for verbose output .. although I just look
at the output after it's done, not while it's actually running.<br>
<br>
If your destination is local, then I suppose you could run 'du -s' on
the destination directory to get some idea of how much you've
transferred so far.<br>
<br>
Getting back to 'vv' for verbosity, what do you get with 'vvv'? Is that useful?<br>
<br>
Good luck.<br>
<br>
Alex<br>
ps Happy whatnot to you too. :)<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">   I currently use the 'FileHandle' module in an attempt to do this:<br><br>my $rsync = new FileHandle;
<br>if ( $rsync->open("$settings{rsync_path} $settings{rsync_switches}<br>--files-from=$files_from $source_dir $dest_dir 2>&1 |") )<br>{<br>        while (<$rsync>)<br>        {<br>                s/\n//;
<br>                print "rsync: $_\n";<br>                if ( time > $show_time )<br>                {<br>                        $show_time=time+$settings{rsync_check};<br>                        print
"report\n";<br>                }<br>        }<br>}<br>else<br>{<br>        die "Gak!...";<br>}<br>$rsync->close;<br>print "rsync exit: $?\n";<br><br>   The problem I have currently is that the 'while (<$rsync>)' loop only
<br>iterates through when the 'rsync' program prints something. So, if<br>'rsync' is quiet for a long time 'print "report\n";' can be delayed.<br>This causes a problem because I am using a web interface and if I can't
<br>print the 'report...' then the connection to the client's browser dies.<br><br>   I tried playing with perl IPC earlier on (months ago now) but I could<br>never quite get it working. No matter what I tried all the file handles
<br>would be destroyed when the child processes returned.<br><br>   I don't want to lose the output from 'rsync' though so if there is an<br>answer, can I still read what 'rsync' prints out as it runs?<br><br>Thanks all!<br>
<br>Madison<br><br>PS - Happy (your holiday of choice)!<br>PPS - I've been looking on CPAN for a module that will do the job (and I<br>heard that one exists) but I can't seem to find it... Though I may well<br>be blind. :P
<br><br>--<br>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>           Madison Kelly (Digimer)<br>    TLE-BU; The Linux Experience, Back Up<br>Main Project Page:  <a href="http://tle-bu.org">http://tle-bu.org</a><br>Community Forum:    
<a href="http://forum.tle-bu.org">http://forum.tle-bu.org</a><br>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br><br>=================================================<br>This email appears to originate from the Toronto Perl Mongers Listserver.
<br><br>Listserv :  <a href="mailto:tpm-BnhL/mGhxvTYtjvyW6yDsg@public.gmane.org">tpm-BnhL/mGhxvQ@public.gmane.orgg</a><br>Administrative queries: <a href="mailto:owner-tpm-BnhL/mGhxvTYtjvyW6yDsg@public.gmane.org">owner-tpm-BnhL/mGhxvTYtjvyW6yDsg@public.gmane.org</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>----------
<br>Linux, Firefox and GMail .. what a combination.