I have a long php script running on the server. Right now, it runs
(maybe a half hour) displaying NOTHING to the person running it. When
it's done, it shows a list of everything that happened. I need to let
the person running it know that it's running and where it is in the
process as the script runs. I'm writing updates to a file called /
backup/status.html. I'd like to kick-off the script (and keep it
running), while at the same time continually displaying the contents
of /backup/status.html.
I think my answer lies in MooTools request.periodical. I just have no
clue how to make that work.... and how to have it kick off the php
script at the same time.
So: kickoff /backup/script.php (and keep it running), at the same
time continually grab and display the contents of /backup/status.html.
I haven't even been able to get request.periodical to work at all.
Here's what I tried:
<script type="text/javascript" src="/backup/mootools13.js"></script>
<script>
var i = 0;
var r = new Request({
url: '/backup/status.html',
method: 'get',
initialDelay: 100,
delay: 100,
limit: 1000,
onRequest: function(){
$('result').adopt(new Element('li', {
html: 'attempt: ' + (i++)
}));
},
onSuccess: function(r){
$('result').adopt(new Element('li', {
html: 'success: ' + r
}));
}
}).startTimer({
sleep: 2
});
(function(){
r.stopTimer();
$('result').adopt(new Element('li', {
html: 'test complete.'
}));
}).delay(12000);
</script>
<body onload="r.start.Timer()">
<div id="result"></div>