Ruiwant
Ruiwant

Reputation: 417

Is there a limit excution time when I run a PHP Script by Cron Jobs?

Is there a limit excution time when I run a PHP Script by Cron Jobs?

For example, I need to backup my big database file through a PHP Script. I set a cronjobs which automatically run everyday.

My question, will the php script run until everything is ok?

Upvotes: 0

Views: 237

Answers (2)

jmullee
jmullee

Reputation: 51

ini_set("max_execution_time", "0");
ini_set("max_input_time", "0");
set_time_limit(0);

Upvotes: 1

krs1
krs1

Reputation: 1135

How I usually set up my cron job scripts is to simply printing everything (especially errors or exceptions) to standard out. To my experience most cron systems will then email the output of the script to whatever local user is running the script. I then have that mail forwarded to my work account to notify me that the script ran and if there were any errors. For basic maintenance scripts that run daily or weekly I've found this to be a quick, effective way to keep me updated on their status.

Upvotes: 0

Related Questions