Daniel
Daniel

Reputation: 205

Setting up a cron job with Laravel and AWS

I have a list of customers' email and I would like to send promos and news every week.

How do I set this up on AWS using Laravel?

What I currently did was using Laravel's queues something like this:

website.com/api/SendScheduledEmail

So far what I have tried is the crontab on Linux but I don't know how can I visit and execute my URL using it.

Upvotes: 2

Views: 1817

Answers (1)

yomamasofat
yomamasofat

Reputation: 11

you can do as per what @eResourcesInc mentioned whereby you add a scheduled command shown below

 $schedule->command('command:send_newsletter')
            ->daily()
            ->appendOutputTo(storage_path('logs/send_newsletter.log'));

Documentation here: https://laravel.com/docs/5.8/artisan

If your task has the potential to take a long time/or consume alot of resources. Maybe you can try serverless, like running your task as a function in AWS or Aliyun. More info here: https://vapor.laravel.com

Hope it helps.

Upvotes: 1

Related Questions