节点与集成

Execute Command

The Execute Command node runs shell commands on the host machine that runs n8n.

Node parameters

Configure the node using the following parameters.

Execute Once

Choose whether you want the node to execute only once (turned on) or once for every item it receives as input (turned off).

Command

Enter the command to execute on the host machine. Refer to sections below for examples of running multiple commands and cURL commands.

Run multiple commands

Use one of two methods to run multiple commands in one Execute Command node:

  • Enter each command on one line separated by &&. For example, you can combine the change directory (cd) command with the list (ls) command using &&.
bash
cd bin && ls
  • Enter each command on a separate line. For example, you can write the list (ls) command on a new line after the change directory (cd) command.
bash
cd bin
ls

Run cURL command

You can also use the HTTP Request node to make a cURL request.

If you want to run the curl command in the Execute Command node, you will have to build a Docker image based on the existing n8n image. The default n8n Docker image uses Alpine Linux. You will have to install the curl package.

  1. Create a file named Dockerfile.
  2. Add the below code snippet to the Dockerfile.
shell
FROM docker.n8n.io/n8nio/n8n
USER root
RUN apk --update add curl
USER node
  1. In the same folder, execute the command below to build the Docker image.
shell
docker build -t n8n-curl
  1. Replace the Docker image you used before. For example, replace docker.n8n.io/n8nio/n8n with n8n-curl.
  2. Run the newly created Docker image. You'll now be able to execute ssh using the Execute Command Node.

Templates and examples

Browse n8n-nodes-base.executecommand integration templates or search all templates

Common issues

For common questions or issues and suggested solutions, refer to Common Issues.

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明