I have a task in the schedule that pings other services to check for responses, and if the response is the same as before, nothing changes. However, if it's different, I update the previous data in the database. But I want to make sure to check if the schedule even ran, because if it didn't, the previous data could be corrupted. Now, the question is how can I check when the previous task was run? I don't think Laravel has a built-in option for that. What's the best approach for this? Should I create a special table for this single record that I would update every time the task runs, or is it better to use the log file (but then how does the performance look like, especially with date conversion to compare with the current one?), or keep the values in cache (but then there's also a risk of memory clearing)? Maybe you have a better approach to this solution? I wouldn't like to always update the dates in every record in this schedule because currently there are 40 records running every 30 seconds, and this number may grow.
How to check when was the last execution of a Laravel scheduled command?
43 Views Asked by clover At
2
There are 2 best solutions below
0
afcyy
On
Try Laravel Telescope on top of the list of the commands and when they last happened, it has a lot of very helpful insights.
Related Questions in LARAVEL
- Function in anonymous Laravel Blade component
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- Laravel: Using belongsToMany relationship with MongoDB
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
- Resolving ElephantIO ServerConnectionFailureException: Error establishing connection to server
- Undefined function getAdminPanelUrlPrefix()'error in Laravel SaaS project after installing chatmessenger
- PHP Laravel SQLServer could not find driver
- Laravel installation via Composer results in connection timeout error
- Is there a way of showing content in a Statamic antlers template if a user is authenticated?
- Livewire component JS script Uncaught SyntaxError: Unexpected token
- is there a solution to run cron job command in cpanel only from my cPanel host?
- Prevent a webpage from navigating away
- Deploy Flutter and Laravel php mobile app on the host server
- Please how I fetch user account balance, withdrawals, Loans and Transactions to display in the dashboard?
Related Questions in SCHEDULED-TASKS
- How to schedule the execution of broadcast tasks from a queue of to be broadcasted data with a one second delay in between each broadcast invocation?
- Is there a way to pass Today's date as a command line argument to Excel from a Windows Task Scheduler Job
- Building a service which sends emails everyday to the user at a particular time. (NOT RUNNING)
- Assign Dynamic values in Annotation
- Create a task in mybb to automatically recount and rebuild forums and threads every 1 minute
- Creating a ScheduledTask in PowerShell to run when any network is available
- I want to extract data from website and refresh that data in 15 days , and whenever website get updated dataset should be updated too. How approach it
- How to create a stored procedure that creates a table at the end of the month, but the table name gets automatically generated based on system date
- Scheduled task that doesn't start
- Toggle Dark/Light Mode in Windows 11 automatically by time of day (without modifying or changing theme!)
- Django-q2 schedule task hook on class function
- Spring scheduled - can I join fixed delay with cron
- Mac LaunchAgent with full disk access and caffeinate
- Airflow Parallel DAG runs
- Netsuite Scheduled script stuck on pending status
Related Questions in LARAVEL-ARTISAN
- Error while attempting to run 'php artisan queue:work' command
- Slightly confused about what Artisan::callSilent does
- Configuring Laravel to Create Log Files with Specific Permissions and Ownership
- Cache::remember() failure in AppServiceProvider during package discovery
- PUT method is not supported for route vehiculos/7676729/edit. Supported methods: GET, HEAD
- Laravel: regenerate cache
- How to check when was the last execution of a Laravel scheduled command?
- How to call migrations in Laravel from one microservice to another?
- Laravel 10 - Extend existing artisan command?
- The "-c" option does not exist in Laravel (artisan)
- How to run CREATE DATABASE command on LIVE Laravel site through get request
- Getting error while mirgating the project
- How to pipe emails from Cpanel to Laravel 8?
- Laravel Image link redirecting to login page in localhost
- Laravel Application Response Time Slow on Kubernetes vs VM
Related Questions in LARAVEL-10
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- Undefined function getAdminPanelUrlPrefix()'error in Laravel SaaS project after installing chatmessenger
- Laravel API DELETE Requests of Resource Controller and Getting 404 Not Found Error (for Second time Delete)
- API addition to web based application (Laravel)
- Invoking Local API from a Laravel controller within the same Laravel application
- Error : ERROR (spawn error) when tried to run supervisor process
- jetstream Class "verified" does not exist
- Implementing multi-user login/logout using username in Laravel
- Resolving the 'Class does not exist' error in Laravel 10
- Laravel10 Filament/ Excel export: Your requirements could not be resolved to an installable set of packages
- How can I disable livewire dev tools on production environment?
- How can I return the soft deleted records in the admin API's
- SSLCommerz-Laravel Payment gateway Pop Up page payment gateway method not come
- Not receiving WebSocket messages in Postman using Laravel and beyondcode/laravel-websockets package
- Laravel login loop
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
One approach to solving this problem is to create a separate table in your database to store the last run time of the scheduled task. This table would have a single row with a timestamp column indicating the last time the task was run. You can then update this row every time the task runs.
Using a separate table to store the last run time, you can avoid the performance overhead of updating the dates in every record in the schedule. Additionally, this approach allows you to easily track the last run time of the scheduled task and take appropriate action if it fails to run within the expected interval.