Sandy C Sandy C - 1 year ago 67
Bash Question

Calling multiple, independent shells in Heroku

I am looking for this kind of shell scripting equivalent in Heroku dynos.

start cmd /k call "batch1.bat"
start cmd /k call "batch2.bat"

I tried

. &
. &

Even this one crashed.

./ &

Would like to know if Heroku supports this activity. If yes, kindly help me with the correct set of commands.

Answer Source

You can spin up a heroku one-off dyno, as follows:

heroku run bash

This gives you an interactive bash shell, from which you can invoke any script in your git repo.

You can also, of course, run "batch" scripts directly, e.g:

heroku run bash -c "ls -lt"

That will spin up a one-off dyno instance, whose bash shell will run whatever command was passed to it, in this case, "ls -lt". After completing the command, the one-off dyno shuts down.

Note that as with all Heroku dynos, the filesystem is ephemeral, so any files created by your script will be gone after your one-off dyno exits.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download