0

I'm using

system('rsync --progress ssh '.$localZip.' user@server:'.$remoteZip);

It starts out saying "filename.zip", but then my page just says loading over and over, and then suddenly at the end it spits out all the progress data. Shouldn't it spit out that data as it goes? It's an 89MB file.

dave4420
  • 46,404
  • 6
  • 118
  • 152
Banning
  • 2,279
  • 2
  • 16
  • 20
  • 1
    You running this from the console or from a webpage? Have you tried flushing your output? – SenorAmor Apr 05 '12 at 16:35
  • yes the very next line is flush(); ... and I am running this through a webpage in php – Banning Apr 05 '12 at 17:02
  • originally i was using just scp but since they were rather large files i wanted some kind of progress bar and what i read online rsync was suppose to give that to me... I dont really know much about running shell commands so i was hoping someone here would be able to tell me if im wanting something that isn't possible or if im doing something wrong in my command – Banning Apr 05 '12 at 17:04
  • You need to flush the output repeatedly while the rsync is still running. Is that possible in php? – dave4420 Apr 05 '12 at 17:49
  • I tried something like this $output = system('rsync --progress ssh '.$localZip.' user@server:'.$remoteZip); while($output){ flush(); }; but that didn't work. – Banning Apr 06 '12 at 13:29

1 Answers1

0

Look at ob_flush() instead of normal flush() as the latter has no effect in browsers.

SenorAmor
  • 3,351
  • 16
  • 27
  • just try ob_flush() and i still get the same result.. i read in the manual you have to call ob_get_contents() first... tried that too but it didnt work. This is all new territory for me so im not sure what to do lo – Banning Apr 06 '12 at 13:28
  • I just ran across this post http://stackoverflow.com/questions/1281140/run-process-with-realtime-output-in-php but it didn't seem to work for me either ... just shows the file im transferring and then all of the progress at once at the end of the transfer. – Banning Apr 06 '12 at 13:40