php - Cron job running every time whenever i run the artisan command -


i have task scheduled run artisan command, , whenever run artisan command executing every time irrespective of time have given cron job.

here console i'm using

 class cronjobconsole extends command { /**  * name , signature of console command.  *  * @var string  */ protected $signature = 'sms:note';  /**  * console command description.  *  * @var string  */ protected $description = 'command description';  /**  * create new command instance.  *  * @return void  */ public function __construct() {     parent::__construct(); }  /**  * execute console command.  *  * @return mixed  */ public function handle() {                //executing function; }       $this->info('remainder sms send !!'); }   }  

and console/kernel.php file

class kernel extends consolekernel {  protected $commands = [     \app\console\commands\inspire::class,     \app\console\commands\fileentrydata::class,     \app\console\commands\cronjobconsole::class, ];  /**  * define application's command schedule.  *  * @param  \illuminate\console\scheduling\schedule  $schedule  * @return void  */ protected function schedule(schedule $schedule) {     $schedule->command('sms:note')->dailyat('19:00')->sendoutputto('cronjob-result.php'); } } 

when run php artisan sms:note executing every time. want execute on particular time have gven.

please me out.

this problem, specify it, artisan's normal behaviour.

you have scheduled command, executed on specified time driven laravels internal scheduler (read below cronjob). can manually execute command, entering in cli.

note: executing command manually has nothing artisan's scheduler. scheduler executes command whenever see fit.

so command looking is:

php artisan schedule:run 

this commands loops through registered commands on specified time, run command when time ready.

to make sure laravel executes command when it's time, create cronjob (on server) run php artisan schedule:run command every minute, laravel takes care of rest.

from docs (insert in crontab):

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 

goodluck!


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -