Is There A Way To Check If Laravel Schedule Is Running?
I am maintaining many copies of one application (built on Laravel) on different hosts, and I am looking for a way to check if Laravel Schedule is actually running for each. Does Laravel offer something for that?
Answer
No, there is nothing built into the framework that will tell you which hosts are running schedule:run
. You will have to implement that yourself.
If you have a central system tracking the hosts, then you can make a command which sends a heartbeat ping to your central system, and add that command to the scheduler.
If you have some logic that depends on knowing whether its current host is running a scheduler,
then you can make a scheduled command which writes the current time to a file on the local disk (writing to the cache also works if it's not shared between hosts, or the key is unique to the host). Then you simply check whether ($now - $last_write) > $schedule_interval
is true.
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?