CRON configuration file

The configuration file used for crontab is /clevercloud/cron.json.

Here is the general syntax:


The string <string> must use the cron format:

M H d m Y command
  • M: Minute [0,59]
  • H: Hour [0,23]
  • d: Day of the month [1,31]
  • m: Month of the year [1,12]
  • Y: Day of the week [0,6] (0 is Sunday)

There are two restrictions about the usage of crontab on our platform:

  • The special date @reboot is not available since the crontab is added after the startup of the instance
  • You must use the absolute path of commands

You can use the special variable $ROOT to refer to the root folder of your application.

Example of clevercloud/cron.json which executes the file cron.php every 5 minutes:

    "*/5 * * * * /usr/bin/php $ROOT/cron.php"

Access environment variables

To have access to environment variable, you must wrap your commands in a bash script. Let's say your command is bundle exec rake myapp:dosomething.

You need to put it in a bash script, starting with #!/bin/bash -l. The -l is very important:

#!/bin/bash -l

cd ${APP_HOME} # Which has been loaded by the env.
bundle exec rake myapp:dosomething

Then you need to commit an executable file:

project/ $ chmod +x crons/
project/ $ git add crons/
project/ $ git diff --cached
diff --git a/crons/ b/crons/
old mode 100644
new mode 100755
project/ $ git commit -m "Make cron file executable"

Then, in clevercloud/cron.json:

    "*/5 * * * * $ROOT/crons/"

Do not double bash!

You might be tempted to put the following in your cron.json file:

    "*/5 * * * * /bin/bash $ROOT/crons/"

Do NOT. Invoking bash here will supersede the shebang and cancel the bash -l that loads the env. So just put the path to your executable

You can refer to this list to see which variables are available.


All the servers are configured to use Coordinated Universal Time (UTC), please keep it in mind when configuring cron tasks to run at a specific hour.


We do not currently support the clustering of cron tasks, you must manage it yourself if your application requires more than one instance.

* For more information about the syntax, you can check this page

Edit me on GitHub