DeployExecute Commands

Execute Commands

You can execute commands within Zeabur services for installing packages, running programs, viewing information, or even backing up specific data.

Open the Command Execution Interface

Open the service, open the menu next to “Logs”, and click “Command” to open the interface.

Open the Command Execution Interface

The command execution interface consists of two parts:

  • Command Input Bar: Allows you to press Enter or click the button next to the input field to execute commands.
  • Command Output Area: Displays the results of the command execution. If the command executes successfully, the output result will be displayed; otherwise, an error code will be shown.

Command Execution Interface

Execute Commands

Taking a basic echo as an example, enter echo Hello, World! and you should see the output result Hello, World!.

Execute hello world Command

Entering a non-existent command will display an error code.

Command Execution Failure

You can even execute SQL statements in database containers like MySQL or PostgreSQL, use cURL to upload logs or back up files, or even run migration programs (e.g., prisma migrate, node seeder.js).

For MySQL, we can copy the “Command to connect to your MySQL” command, delete the host and port parameters (no need for remote connection within the container), rewrite mysqlsh to mysql (since mysqlsh is not available in the container), and finally add -e to execute the SQL statement.

mysql --user=root --password=<password> --database=zeabur -e "SHOW DATABASES;"

Execute MySQL Command