You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I couldn't get a script run at a specified date..
This is my code... it is not executing at the date specified it is rather executing instantly.. please help me.
$datetorun = new DateTime('2018-09-04 18:48:00');
$scheduler = new Scheduler();
$scheduler->php($pathtophpscripttorun, '/usr/local/bin/php')->run($datetorun);
what am i doing run.. please help.. i want the skip to run at the date specified.
The text was updated successfully, but these errors were encountered:
@Oguntoye by passing the date to the run method you're effectively faking the current time in the system. The job has no specified time to run so it's assumed it should run every minute.
To give you an example, the above code is registering a new job to run every minute, then when the scheduler gets executed it's assuming the current date is 2018-09-04 18:48:00 instead of the actual now date, so every time the scheduler runs it will always run as it was that date/time.
Passing the date to the run method is primarily used to facilitate testing of the scheduler (you can find more details here #28 (comment))
Instead, if you want to run your script at a specific date and time, you might do so by using a cron expression, so your code will look like
Just a note, that will execute the script every year on that date and time (cron don't have support for the year), another workaround would be to add a condition before scheduling the job. Example of pseudocode below
I couldn't get a script run at a specified date..
This is my code... it is not executing at the date specified it is rather executing instantly.. please help me.
$datetorun = new DateTime('2018-09-04 18:48:00');
$scheduler = new Scheduler();
$scheduler->php($pathtophpscripttorun, '/usr/local/bin/php')->run($datetorun);
what am i doing run.. please help.. i want the skip to run at the date specified.
The text was updated successfully, but these errors were encountered: