Sunday, 15 March 2015

curl - wget process doesn't stop when php cron ends -



curl - wget process doesn't stop when php cron ends -

i'm running cron using:

$command = 'wget -qo- --timeout=0 --tries=1 my_url &'; $descriptorspec = array( 0 = > array('pipe', 'w'), // stdin 1 = > array('pipe', 'w'), // stdout 2 = > array('pipe', 'w') // stderr ); $proc = proc_open($command, $descriptorspec, $pipes); proc_close($proc);

the reason have utilize timeout=0 range of time cron run vary seconds couple hours. noticed if cron takes longer couple of minutes, if run above way, keeps hanging in process tree (even when job done, cron finished task). tried forcefulness stop sending:

header("connection: close"); ob_end_flush(); ob_flush(); flush();

what want accomplish able know when process finished, can determine whether stopped because did work or because there sort of error.

each cron similar to:

session_write_close(); ignore_user_abort(1); .... do_the_job .... header("connection: close"); ob_end_flush(); ob_flush(); flush(); exit();

how can forcefulness wget die? appreciate tips in matter. tried curl without luck.

in particular case able overcome problem running command:

php5 index.php --uri=controller/method/var1/var2

for kohana files, and

php5 file_path/file_name.php

for other php files. if had run file different server solution wouldn't work.

php curl cron wget

No comments:

Post a Comment