Skip to content
Dropsolid Help Center home page
Product documentation
DevOps Cloud

Configuring cronjobs in the Dropsolid Experience Cloud

All projects on Dropsolid Experience Cloud support the use of scheduled (cron) jobs.

  • Out of the box all drush commands are supported.
  • Custom cronjobs are also supported but do require infra to set them up.
  • Invalid drush commands the cronjob will not be created.

Create a Cronjob

To add new job just fill the name, a valid drush command and the frequency (hourly, daily, weekly or montly).

create_job

There are however some caveats as a developer, you have to be aware of:

  • The >, | and ; characters have special meaning in bash, we thus restrict the use of these characters. Look in the best practices section below for some examples of common use cases.
  • Creating cronjobs of any type for a live environment can currently only be done by infra

Therefore, crons looking like the examples below are not valid (anymore):

    drush @PROJECT.ENV ev 'shell_exec("cp ../file.default ../file");'
    drush @PROJECT.ENV migrate-import products; drush @PROJECT.ENV migrate-import --group=product_translations
    drush @PROJECT.ENV cron > /var/www/project_type/PROJECT/ENV/private/files/logs/log.txt

Best practices

  • Use a script to
    • Execute multiple commands that should be executed sequentially
    • Store the output of a cron in a non-default logfile (see logs section below)
  • Use drush core-execute to run shell scripts you have written to execute bash commands.

        drush @PROJECT.ENV core-execute ../etc/cron/script.sh
    
  • Use a PHP script and drush scr instead of running a single command using drush ev.

        drush @PROJECT.ENV scr --script-path=../etc/cron/script.php
    

  • Store scripts meant to be used as crons in PROJECT/etc/cron
  • Test your Drush commands on the web server before adding them to the Experience Cloud as cron jobs to ensure everything works.

Limitations

  • Limited Scheduling: Restricted to minute-level granularity; not ideal for high-frequency tasks.

  • No Error Handling: No built-in mechanism for handling job failures or retries.

  • Time zone Sensitivity: Cronjobs are sensitive to time zone changes and may cause issues during daylight saving time.

  • Limited Visibility: Monitoring and tracking job performance or failures is not straightforward.

  • Non-admin users lack cronjob support for custom timings or schedules beyond the predefined minute, hour, day, month, and weekday fields. This can be limiting when dealing with tasks that require non-standard intervals, such as every 90 minutes, or tasks that need to be triggered based on specific events or conditions.

Logs

You can download the cron logs using the "Download logs" action of an environment. If the logs are not available in the list for your specific cronjob, contact infra and specify which cronjobs you would like logs for.

Send us your question

Do you still have unanswered questions or do you want to make some adjustments to your project? Don't hesitate to ask us your question at support@dropsolid.com or at +3293950290.