GitHub Repository


Tasks Scheduling

Tasks Scheduler:

Below is a quick guide for how to schedule some scripts execution such as (custom Shell Commands, Laravel Commands, Laravel Jobs, and other classes), in order to run at specific intervals or dates.

Server Setup

First let’s set it up, by adding our single Cron entry, on the server. As follow:

1) Type crontab -e

2) At the last line add the following: * * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1

Don’t forget to replace the path-to-your-project.

More details here.

App Setup

First you need to create some commands, that needs to be scheduled. The can be created in the Containers (app/Containers/{container-name}/UI/CLI/Commands) or in the Ship (app/Ship/Commands). See the Commands Page.

Once you have your command ready, go to app/Ship/Kernels/ConsoleKernel.php and start adding the commands you need to schedule inside the schedule function.


    protected function schedule(Schedule $schedule)
         $schedule->job(new myJob)->hourly();
         $schedule->exec('touch me.txt')->dailyAt('12:00');
         // ...

More details here.

NOTE: you do not need to register the commands with the $commands property or point to them in the commands() function. Apiato will do that automatically for you.