Forum Moderators: coopster

Message Too Old, No Replies

ignore user abort

         

FiRe

10:34 am on May 3, 2008 (gmt 0)

10+ Year Member



I am struggling to get my head around ignore_user_abort()

I have a script that does a number of database and file operations on a server, the whole thing takes about 5 minutes to execute.

After each section, the script echo's that part has been done and then flush's it, so that my client can see where its up to in real time.

However the client wants to setup a cron so that it runs automatically each night without him having to open his browser and execute the script each time.

If I setup a cron, should I set ignore_user_abort in the script because the cron does a simple GET request and surely wont hang on for 5 minutes?

If you read the manual [php.net] it says something about flush which is why I am confused.

So, any ideas? Thanks in advance.

henry0

11:33 am on May 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aren't you using ignore_user_abort as a pseudo cron?
so if you move to a "real" cron could you explain why you would still use it?
Sorry if I did get you loud and clear :)

FiRe

7:07 pm on May 5, 2008 (gmt 0)

10+ Year Member



Well no I am not using it at all, basically if I setup a cron to do a GET request on the script (without ignore_user_abort turned on) will it fully execute the 5 min process despite there being no physical web browser?

MattAU

11:52 pm on May 5, 2008 (gmt 0)

10+ Year Member



If it's run by cron then there's no user to abort the process, so yes it will run until it's finished or until it reaches max_execution_time.

FiRe

2:41 pm on May 6, 2008 (gmt 0)

10+ Year Member



If it's run by cron then there's no user to abort the process, so yes it will run until it's finished or until it reaches max_execution_time.

Ok, and thats true if I dont use ignore_user_abort() at all in my script ?

MattAU

10:44 pm on May 6, 2008 (gmt 0)

10+ Year Member



Yep, you don't need to use ignore_user_abort with a script that's only run by cron.