How to run Heroku CLI commands from Heroku Scheduler?

Issue

How can I run Heroku CLI commands from the Heroku Scheduler, one off dynos or worker dynos?

Resolution

The CLI can be installed with the CLI buildpack or by using the following command as the first step in your scheduler script

~ $ curl -s https://cli-assets.heroku.com/heroku-linux-x64.tar.gz | tar xz

You'll need to set a valid API key on your application to run any application specific commands. You can generate a key by using heroku authorizations:create on a machine that is currently running an authenticated version of the Heroku CLI. You can then set a configuration variable on your application that will make this API key available when needed by the CLI. The configuration variable should be named HEROKU_API_KEY and can be set by running heroku config:set HEROKU_API_KEY=(API_KEY_HERE) -a my-app.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2020 Salesforce.com