symfony - best practice how to schedule symfony2 action -
my application based on symfony2 has standalone jobs @ differents moments , differents frequencies. exemple, sending newsletter, editing report ...
i want able add/edit each task application task close cron jobs , consist call specific url.
from point of view :
i think creating cron job launch script every half hour, or ten minutes. script curl command witch docronjob action. docronjobaction inside symfony , responsible task , launch 1 has to.
my questions :
- is there cleaner way achive ?
- inside docronaction how launch others action ?
- how manage set time limit 0 entire controller ?
- does bundle doing allready exist ?
it sounds storing schedule of tasks in database. no problem. every different type of task (eg. sending newsletter, save reports) create service, task. add services tag (like twig.extension, but own), have taskchain, knows tasks.
for executing create console command, retrieves schedule database, loads taskchain, , executes tasks. console command can called cronjob without exposing web. in fact calling command via php-cli , not browser, standard time limit unlimited. no controllers should involved executing.
this should organized in taskbundle.
Comments
Post a Comment