در حال بارگذاری ...

Testing Heartbeat URL1:03

and you can see when it warns after, which is 10 minutes, and the current status, and then this URL, which is important. This URL, when it is pinged, will actually update the last check-in time. So, you can see right now our last check-in is 4-13-16. So, let's go ahead and manually hit this URL. Okay, and we got an okay response. And now let's update this page. And if we go to the Heartbeats tab, you can see that now it's updated to 4-13-41. So, that's going to keep you updated on when we last heard from your cron job. All right, so how do we actually hit this from our Laravel application or from a cron command?

Adding Curl to Cron1:33

So, that's going to keep you updated on when we last heard from your cron job. All right, so how do we actually hit this from our Laravel application or from a cron command? Now, if you're just using a regular cron and you're not using Laravel at all, what you can actually do is just make your cron command look something like this. So, within your cron file, you might have your php command, and then just add an and, two ampersands, and then just curl the Heartbeat URL. And that's really all you could do from a plain php application is just set up your cron job to look like that so that the beats.envware.io URL is called after your command runs in your cron. So, if you're using Laravel, you can actually do something a little simpler.

Pinging URL in Laravel Scheduler2:11

so that the beats.envware.io URL is called after your command runs in your cron. So, if you're using Laravel, you can actually do something a little simpler. So, within our console kernel, we're within our kernel now. We can actually go down to the schedule. And let's say we want to make this inspire command run every 10 minutes. And then you can say, let's come down here, then ping and paste in that URL. And that's really all there is to it. We can run that command every 10 minutes and then tell the scheduler that after we're done running this command, we want to ping a certain URL. So, we've made that change in our application.

Configuring Scheduler in Forge2:48

we want to ping a certain URL. So, we've made that change in our application. Let's go ahead and commit that change, add job, and we'll push it up. And I think we should have automatic deployment still turned on. Let's see. Yes, we do. So, that's going to deploy the application to our server. So, while that's deploying, let's talk about how we can run that cron. So, the Laravel scheduler can be easily set up via Laravel Forge. So, let's go to the server, go to the scheduler, and really all we need to do is modify this command to go into the current folder, not just the default folder, but to the default folder current/artisan.

Running schedule:run Cron3:18

So, let's go to the server, go to the scheduler, and really all we need to do is modify this command to go into the current folder, not just the default folder, but to the default folder current/artisan. All right, so that's going to get us the most latest release. And we're just going to run that schedule:run command every minute. All right, so let's schedule that. And we should schedule our cron command to start running. All right, so now we've got our cron set up, and our application is deployed. Now, we should hear from this cron every 10 minutes, and it will update our lastCheckInTime. If we don't hear from the cron after 10 minutes, it will be listed as missing in action, which I'll show you. So, let's go ahead and remove that ping, all right, so that it's not actually calling on Voyeur.

Wrapping Up Envoyer Heartbeats5:09

but also your cron jobs are still working as you would expect, and it's super easy in Envoyer.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟