Appearance
Cron module overview
We have console commands that should run with some periodicity. To do it, we use cron.
Unlike in default Laravel application, we do not store this information about command periodicity (“cron expression”) hardcoded in codebase, but use a database instead. This allows non-developers to change these expressions anytime with a friendly UI.
Cron expression
text
* * * * *
- - - - -
| | | | |
| | | | |
| | | | +----- day of week (0 - 7) (Sunday=0 or 7)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)See more docs with examples: https://github.com/dragonmantank/cron-expression
Verbosity levels
Use Verbosity levels.
Consider writing about errors and important warnings using the default OutputInterface::VERBOSITY_NORMAL level. See conventions for Artisan-commands for details.
Exit codes
Use non-zero exit codes if a command failed with error (alternatively, throw an exception — this is the same as exit code 1).
Dashboard
Sometimes we need a GUI to run some console commands (usually non-technical staff do it) For this reason, we developed /admin/console-commands dashboard, where you can run and manage some console commands whitelisted as safe for the dashboard.
There are a few interfaces to add a console command to the dashboard:
App\Modules\Common\Console\Commands\ExecutableViaDashboardto be able to execute the CC from the dashboardApp\Modules\Common\Console\Commands\JobsManagedViaDashboardto be able to manage tasks for a given CC via dashboard
The default strategy is to make commands ExecutableViaDashboard only for the sanoty check console commands (e.g., monthly invoice check).