简体   繁体   中英

Run command on a Azure VM from bash with Azure CLI

I trying to set up a bash script that connects to multiple VM instances on Azure. On each of these instances, I want to execute several commands.

The documentation says I can use the following command:

az vm run-command invoke -g RG1 -n Server1 --command-id RunShellScript --scripts "memcached -t 1 -p 11211 &"

Due to the '&', the command should execute in the background and should not block further bash commands (at least for my understanding).

But the terminal is blocked and exits with an error:

 Long-running operation wait canceled.  

How is this done the right way?

Run command uses the VM agent to run shell scripts within an Azure Linux VM. It's a task and needs to return a result to finish the task. Or it will continue to run the task until the maximum time and return time out.

Outbound connectivity from the VM is required to return the results of the script.

For more details about the limitation of the Run command, see Restrictions .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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