How does one run multiple commands for a single process?

I have a single process in my fly.toml:

[processes]
  cron = "supercronic /app/crontab"

When the machine boots, I would like to run more than one command.

The following does not work:

[processes]
  cron = "node /app/src/main.js & echo 'This never gets called...' & supercronic /app/crontab"

Nor does calling the supercronic command first:

[processes]
  cron = "supercronic /app/crontab & node /app/src/main.js"

# The supercronic command will take the `& node /app/src/main.js` as arguments and fail

I need those commands to run on the same machine, which is the reason why I’m not creating a separate process.

Is this even possible?

Thanks


Edit 1

I also tried changing the CMD at the bottom of my Dockerfile to CMD [ "node", "src/main" ], but it seems like this command is never really called.

1 Like

This might help: Running Multiple Processes Inside A Fly.io App · Fly Docs

Hey @rubys, thanks for the answer.

This article explains how to run multiple processes - 1 per machine/vm, as opposed to running all of them on the same machine.

Are you aware of a way that allows to run multiple commands on the same machine (e.g. not using process groups)?

Thanks :pray:

Read further. Specifically the following sections:

  • Just use Bash
  • Use Supervisord
  • Use a Procfile Manager

Sweet, I used the overmind Procfile manager.

Thanks for the help :pray:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.