jeudi 14 janvier 2016

How to capture output from a non-command scheduled task in Laravel?

Given the following snippet:

    $schedule->call(function () {
        // echo "HELLO 123";   // nope
        // return "HELLO 123"; // also nope
    })
        ->everyMinute()
        ->sendOutputTo(storage_path('logs/cron/hello.cron.log'))
        ->emailOutputTo('me@example.org');

The scheduled task is running, the emails are being generated, but with no content. I can capture output via the $schedule->exec and $schedule->command.

Ideal end state here is, run a few internal, non-command processes within the call method and output the results into a file/email.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire