Heroku: "bash: ./start.sh: Permission denied"

Nifty255 picture Nifty255 · Feb 14, 2015 · Viewed 10.1k times · Source

I have an app with a Procfile set to run a shell script, but Heroku will not run the script, stating "Permission denied".

Procfile:
web: ./start.sh
start.sh:
#!/usr/bin/env bash
clear;
until node app.js; do
    echo "Server crashed with exit code $?.  Respawning.." >&2
    sleep 1
done
Heroku log:

Starting process with command './start.sh'
bash: ./start.sh: Permission denied
State changed from starting to crashed
Process exited with status 126

Answer

rici picture rici · Feb 14, 2015

For that to work, start.sh must be executable:

chmod a+x start.sh

If you cannot arrange for that to happen on the machine where the file runs, you can invoke it directly with bash; instead of ./start.sh, use bash ./start.sh (or even just bash start.sh)