mardi 12 septembre 2017

How to start a cron job using schedule:run manually in Laravel 5 (October CMS actually)

I know how to run cron jobs on Linux server, I know how to use $schedule->command('foo')->daily(); I have read this document many times http://ift.tt/2abk27w

But my question is where shall I write this line exactly $schedule->command('foo')->daily();? and what is $schedule variable actually? I mean is this any predefined variable in parent classes to which we can directly call if not which class we shall include in our file and how to instantiate this $schedule object.

My main concern is what is the elegant way to schedule jobs, what is the point of writing this in code where i am writing my logic because this line should run once in lifetime if I am not wrong because this will then push the job in Jobs table and then * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1 should take care of it for rest of the lifetime

then where exactly I shall write such code which will run only once while we deploying the application on the server before starting the main cron schedule:run.

Please, someone guide me why there is no written document for how to run a scheduled task manually without writing it in a code which will be called many time during execution of a real world web application.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire