简体   繁体   English

如何使用Azure Logic Apps在Unix服务器中执行Shell脚本

[英]How to execute a shell script inside a unix server using Azure Logic Apps

I am trying to run a shell script inside a Unix server using Azure Logic Apps. 我正在尝试使用Azure Logic Apps在Unix服务器中运行Shell脚本。

I tried several approaches to execute the shell script 1.(in the diagram). 我尝试了几种方法来执行Shell脚本1.(在图中)。 Can anyone suggest me a new approach or any idea to execute the shell2 from shell 1. 任何人都可以向我提出一种新方法或从shell 1执行shell2的任何想法。

#!/bin/sh
touch testing.txt

HOST = '10.2.166.122'
USER = 'johndoe'
PASSWD = 'abc@123'
FILE = 'shell2.sh'
PATH = '/appdata/files/samplefile/bin'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $PATH
execute $FILE
quit
END_SCRIPT
exit 0

Basically i need to pass the server credentials as well as server shell script location path as parameters. 基本上,我需要将服务器凭据以及服务器外壳脚本位置路径作为参数传递。

设计

You could run your shell scripts with Run Command remotely using the VM agent. 您可以使用VM代理通过“运行命令”远程运行Shell脚本。 Run Command can be used through the Azure portal, REST API, or Azure CLI for Linux VMs. 可以通过Azure门户,REST API或适用于Linux VM的Azure CLI使用运行命令。

For more details you could refer to this doc: Run shell scripts in your Linux VM with Run Command . 有关更多详细信息,请参考此文档: 使用Run Command在Linux VM中运行shell脚本

And in your situation, I think what you want is the REST API, so you could post the request, and in the logic app you could also use the REST API to send the request. 在您的情况下,我认为您想要的是REST API,因此您可以发布请求,并且在逻辑应用程序中,您还可以使用REST API发送请求。

And this is the REST API: Virtual Machines Run Commands - Run Command . 这就是REST API: 虚拟机运行命令-运行命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM