Currently, custom crontab files are only supported within the cli container.
A crontab file has six fields for specifying minute, hour, day of month, month, day of week, and the command to be run at that interval. See below:
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
By default, cron runs commands through /bin/sh and can sometimes cause issues when trying to run commands that are
found within the $PATH. One recommendation is to wrap the commands in bash -l -c so that the profile can load. An
example of this would be using drush to run cron on a drupal website.
* * * * * bash -l -c 'drush --root=/var/www/docroot core:cron'
Cron can be started within a project by creating a crontab file within the projects .docksal/services/cli folder.
Once that file has been created or modified, the cli container should be restarted by running fin restart cli.
Was this page helpful?
Thanks for the feedback. If you have a specific, answerable question about how to use Docksal, ask it in Discussions on GitHub. Open an issue if you want to report a problem or suggest an improvement. You can also contribute changes to this page using the link in the top right corner.