Cron jobs are periodical tasks required for your projects and that can be run by devpanel similarly to how cron works in UNIX systems.
In this article, we will create a very simple cron job called "echo". It will just print a value of an environment variable set by injecting a secret, and the lines printed by the cron job will be registered in the logs and can later be viewed there.
In the project navigation menu, click on "Cron Jobs".
In the cron job manager, click on "New Cron Job".
Then scroll down to fill other fields described in the next subsection.
*/2 * * * *
.Then scroll down to fill other fields described in the next subsection.
Here we can specify the command that will be passed to the container in which our cron job will run. In this example, we will use the command sh -c 'echo DB_NAME: $DB_NAME'
, which will print the environment variable $DB_NAME
from the "database-live" secret we specified before.
Each argument of the command must be in a separate field. Use the "+" button to create as many fields as there will be arguments.
Create 3 fields using the "+" button and enter the 3 command arguments:
sh
-c
echo DB_NAME: $DB_NAME
Then scroll down to fill other fields described in the next subsection.