Azure / Azure/azure-linux-extensions

commandToExecute not work as linux shell

Open
#274 3 comments 0 reactions 0 assignees View on GitHub
extensions/CustomScript question
Dominant language
Python
Stars
333
Forks
278
Avg merge
2d 9h
Merged PRs (30d)
4

Description

I try to do a simple things with CustomScriptForLiunx.
Step 1 :install squid
Step 2 : start squid service
so I use this command in CustomScriptForlinux
$settings='{"commandToExecute":"yum install squid -y;service squid start"}'
after I run the powershell command
Set-AzureRmVMExtension -ResourceGroupName -VMName vmsquid -Publisher "Microsoft.OSTCExtensions" -TypeHandlerVersion "1.5" -ExtensionType "CustomScriptForLinux" -SettingString $settings -DisableAutoUpgradeMinorVersion -Name SSHExtension -Location "China North"

I didn't get an output a my expected:The squid installed and started.
I got a message as below:
----------------------------------------------------------------------------
---stdout---
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
**No package squid;service available.**
**No package start available.**
Resolving Dependencies
--> Running transaction check
---> Package squid.x86_64 7:3.1.23-16.el6_8.6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
-----------------------------------------------------------------
It work like the second command "service squid start" became a part of the first command "yum"
I also try to use command "yum install squid -y && service squid start" and yum install squid -y |service squid start"
But I got the same problem.
My VM is CentOS 6.6

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the CustomScriptForLinux command execution entry point and reproduce the CentOS 6.6 settings with the reported yum and service commands. Check how commandToExecute is passed to the shell and verify completion by confirming that squid installs and starts without treating the second command as a package name.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, linux, shell
Domain
cloud, devops, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.