General Question about running daily Script via CRON vs. within Web MVC framework, e.g. Laravel

Solution for General Question about running daily Script via CRON vs. within Web MVC framework, e.g. Laravel
is Given Below:

I have an old MVC framework that I am migrating to Laravel, but currently still using the old Framework. I have a script that:

  1. Requires a user to be logged in as a user with Admin privileges.
  2. Sends out e-mail and/or SMS appointment reminders and other messages upon making a call to the Controller that handles that. That works fine from within the WebApp.

I want to just run that as a daily job, which seems most suitable for a CRON job. I could just set it up as a CRON job similar to something like this. Not sure if the ‘‘she-bang’ should be #!/bin/sh or #!/bin/bash for starters. And I could add an Authorization and Token Headers to allow bypassing the need for the user to be logged in on the webapp side, which would be easier since it could just use what is in place on the WebApp. The alternative would be to write a self-contained script, which require a lot of work because it uses e-mail packages, AWS SNS SDK for SMS, etc.

#!/bin/sh vs. #!/bin/bash
# script to run the reminders web script

curl -v -k -H "Authorization:Bearer CRON" -H "Token:Token" https://domain.test/Reminders/sendReminders

Since I am migrating to Laravel, it looks like Laravel 8.x does have some support for Task Management and Scheduling: Task Scheduling, Laravel

I am presuming that maybe I could migrate my code to Laravel and then implement a Task Scheduler on the Laravel App to handle the Task and behave in a fashion similar to a CRON job without having to setup and maintain a CRON job ? I would have to still add quite a bit of code to Laravel (e.g. the Amazon SDK setup, e-mail templates, etc., but I’ll need to do that eventually anyways).

I started to look at the Laravel docs and it says that I would need to modify the AppConsoleKernel.php file to add my task, probably something sort of like this since I have a MySQL appointments table that has all of the appointments and also a Method that handles sending out the reminders.

protected function sendReminders(Appointments $appointments)
    $appointments->call(function () {

I haven’t tried that on Laravel yet, but before I get started wanted an overview of how it works. It isn’t clear to me how it just sort of “magically” executes on a periodic basis ? Is there some sort of background process in Laravel than handles all of that, as long as the server is up and running ? For example, an am using NGINX as a server for the Laravel application. If the server is running and no one signs into or even using the Laravel WebApp for days say, how does Laravel know to execute that daily script ? It must do some setup behind the scenes at the system level that sort of mimics what the OS would do with CRON jobs, or otherwise has a script that runs as a background process and executes the scheduled Kernel console tasks when they are triggered to run ?