In this episode, we're moving from manually running our performChecks
command to having it run automatically on a schedule. We start off by looking at Laravel's built-in scheduler — but it can only run commands every minute at its most frequent, which doesn't cut it for our needs since we want to check every second.
To solve this, we install the Laravel Short Schedule package, which lets us schedule commands every single second (or even a custom range of seconds). We walk through installing the package, setting up the new shortSchedule
method in the console kernel, and updating our checks command to run every second.
After that, we check our logs to confirm everything is working as expected. Now, the endpoint checks run automatically at the right frequency, and we can see their status updates logged in real-time.
Next up, we'll start storing the results of these checks, but for now, we've automated the scheduling process so we don't have to worry about manually kicking things off anymore!