Is there a way to launch a cron job in the app platform?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
6 answers

👋 @john375105

A cron jobs feature is on our roadmap, though I don’t have a public release date as of right now. In the meantime, one option is to run a Worker component that acts as a cron job.

If you needed something the runs continuously you could use a worker with a run command like:

while true; do
    echo "=> Running scheduler"
    php artisan schedule:run || true;
    echo "=> Sleeping for 60 seconds"
    sleep 60;
  • @jfriesen

    How this code is supose to be in a github repository as valid for App detection?

    • 👋 @matheusstag

      This code is an example of a triggering Laravel tests. It would be used alongside a Laravel app in a worker component.

      • Thanks for reply.

        I didn’t express myself well, but I found the way.
        Just setup same repository as worker component and change the run command from
        heroku-php-apache2 public/

        while true; do
            echo "=> Running scheduler"
            php artisan schedule:run || true;
            echo "=> Sleeping for 60 seconds"
            sleep 60;

        Now I’m wondering what it would be like run php artisan queue:work as the same way. For now, my tests doesn’t work

  • This is a feature we also would like to see. A always running worker is not perfect. Thanks !

  • Is there any date when normal cron job will be available?

    I love using app platform (switched from heroku) - it works like a charm, but it’s a huge drawback that there’s no cron job built in nor there’re no tutorials for using celery in App Platform.

    Would be great to know when you could provide on or another solution.

    Thank you.

  • Hello @crashoverride , please let me understand..
    What do you mean with “run command”? What I need to do to run 1st time the loop script?

    I don’t try yet but… do I need to create an .sh script, put it in the repository and then accessing app platform running it manually for the 1st time from the command line tool?

    Thank you

  • Six months later, we still can’t run cronjobs?
    I’ve tried accessing “crontab” within the component’s console, but obviously, command’s not found.

    Any update?

Show answer This answer has been marked as resolved by emilmoe.

Any news of how to set a cronjobs in the app plataform?

Any news on this? we really need this feature

Another alternative, at least for people who run Rails apps on App Platform:

Use a worker, and Sidekiq with Sidekiq-cron.

There is also Arask, which runs when rails server is started. Not sure about performance implications though…