|
Posted by Arjen on 04/28/06 09:01
news@celticbear.com wrote:
> I've a PHP script that does some stuff, zips up some files, and starts
> an FTP process.
>
> I need it to do the Zip and FTP in the background and let the page
> finish, otherwise the user could have that page sitting there loading
> for 20 minutes while the FTP completes.
>
> Here's what I have:
>
> $zipfile = $order_po.".zip";
> exec("/var/www/html/services/ftp.sh $zipfile 2>&1 &", $output2,
> $status);
> echo "<div align='center' class='style1_hd'>Your auto-created ZIP file
> is currently being sent through FTP!</div></body></html>";
> exit();
> ?>
>
> (The ftp.sh is the FTP logon and transfer script.)
> As you can see I have the & to make it a background process, and
> sending the stdoutput elsewhere.
>
> Any ideas?
>
> Thanks!
> Liam
Im not quite sure if it is the neatest solution but for these kind of
operations I create a todo file/table/etc and have crontab check the
file every x mins and then execute the a script based on the parameters
given in the todo file. You can catch the output and store it wherever u
like.
Arjen
Navigation:
[Reply to this message]
|