Restart my heroku application automatically

后端 未结 7 1576
北海茫月
北海茫月 2020-12-13 08:01

This terminal command restarts my heroku application:

heroku restart

Is there a way to run a script that will run this command and restart

7条回答
  •  渐次进展
    2020-12-13 08:35

    I solved this with a very simple curl command script within the repo that is triggered using the free Heroku scheduler.

    #!/bin/sh curl -X DELETE "https://api.heroku.com/apps/${HEROKU_APP_NAME}/dynos" \ --user "${HEROKU_CLI_USER}:${HEROKU_CLI_TOKEN}" \ -H "Content-Type: application/json" \ -H "Accept: application/vnd.heroku+json; version=3"

    See https://gist.github.com/mattheworiordan/f052b7693aacd025f025537418fa5708.

提交回复
热议问题