Resources for Developers

Run Scheduled Tasks

Running scheduled tasks on Scalingo should be done by yourself. We don’t implement cron or cron-like features in our container system. Most languages have alternatives. We list some of them below:


In Ruby you can use clockwork, resque-scheduler or sidekiq-scheduler (Sidekiq Enterprise has cron-like feature built-in) for example.

With clockwork, you would end up with a Procfile similar to this one:

web: bundle exec puma -t 1:3 -p $PORT
clock: bundle exec clockwork clock.rb

Once your application has been deployed, scale your ‘clock’ to 1 to start the task scheduler:

scalingo --app my-app scale clock:1


With PHP, you can use the package cron/cron, otherwise each framework has its own task scheduler. You may want to use:


A complete example project can be found at the following address:

It uses the package cron/cron to implement the tasks scheduler. Its initialization is done in the file cron.php and a new kind of container is defined in the Procfile of the project, the container type clock:

clock: php cron.php

The file which implements the cron-like process is defined in cron.php:

  require(__DIR__ . '/vendor/autoload.php');

  echo "[CRON] Starting tasks scheduler\n";

  function build_cron() {
    // Increment redis key every minute
    $inc_job = new \Cron\Job\ShellJob();
    $inc_job->setCommand('php inc.php');
    $inc_job->setSchedule(new \Cron\Schedule\CrontabSchedule('*/2 * * * *'));

    $resolver = new \Cron\Resolver\ArrayResolver();

    $cron = new \Cron\Cron();
    $cron->setExecutor(new \Cron\Executor\Executor());
    return $cron;

  // Every 60 seconds, run the scheduler which will execute the tasks
  // which have to be started at the given minute.
  while(true) {
    $cron = build_cron();

    echo "[CRON] Running tasks\n";
    $report = $cron->run();
    while ($cron->isRunning()) { }

    echo "[CRON] " . count($report->getReports()) . " tasks have been executed\n";
    foreach($report->getReports() as $job_report) {
      $output = $job_report->getOutput();
      foreach($output as $line) {
        echo "[CRON] " . $line;

mode_edit Suggest edits