Skip to main content
You can execute commands in a running sandbox and receive its output by using the following command.
Bash
novita-sandbox-cli sandbox exec <sandbox-id> <command>

Execution options

--background flag lets you run a command in the background and return immediately. The command will print the process ID (PID) to stderr:
Bash
novita-sandbox-cli sandbox exec --background <sandbox-id> "sleep 60 && echo done"
--cwd flag specifies the working directory for the command.
Bash
novita-sandbox-cli sandbox exec --cwd /home/user <sandbox-id> ls
--user flag specifies the user to run the command.
Bash
novita-sandbox-cli sandbox exec --user root <sandbox-id> apt-get update
--env flag lets you set environment variables. Repeat the flag to set multiple variables.
Bash
novita-sandbox-cli sandbox exec --env NODE_ENV=production --env DEBUG=true <sandbox-id> node app.js