jgstew / tools

various scripts and tools
MIT License
23 stars 14 forks source link

install_bigfix.sh failed in an azure script extention #15

Closed jgstew closed 8 years ago

jgstew commented 8 years ago

using this version: https://github.com/jgstew/tools/commit/df5c5f0181f1ec19cac22ca81a32c5b1f979ba91

the azure command was sh install_bigfix.sh FQDN_OF_BIGFIX_RELAY

The location that the script was run by azure is: /var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.5.2.0/download/0

I found this location by running the following command: sudo find / -name "install_bigfix.sh" 2>/dev/null

Reference: http://www.codecoffee.com/tipsforlinux/articles/21.html

jgstew commented 8 years ago

When an azure script extension for linux is used, the default command uses sh instead of bash and the install_bigfix.sh script is only compatible with bash at the moment and not sh.

jgstew commented 8 years ago

stdout:

dpkg is /usr/bin/dpkg
rpm: not found
curl is /usr/bin/curl
iptables is /sbin/iptables
firewall-offline-cmd: not found
firewall-cmd: not found

stderr:

install_bigfix.sh: 50: install_bigfix.sh: [[: not found
install_bigfix.sh: 85: install_bigfix.sh: [[: not found
install_bigfix.sh: 101: install_bigfix.sh: [[: not found
install_bigfix.sh: 107: install_bigfix.sh: [[: not found
install_bigfix.sh: 121: install_bigfix.sh: [[: not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 13.8M    0 14024    0     0  46803      0  0:05:11 --:--:--  0:05:11 46746
  6 13.8M    6  900k    0     0   699k      0  0:00:20  0:00:01  0:00:19  699k
 21 13.8M   21 3071k    0     0  1354k      0  0:00:10  0:00:02  0:00:08 1353k
 64 13.8M   64 9214k    0     0  2816k      0  0:00:05  0:00:03  0:00:02 2816k
100 13.8M  100 13.8M    0     0  3883k      0  0:00:03  0:00:03 --:--:-- 3882k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  124k  100  124k    0     0   215k      0 --:--:-- --:--:-- --:--:--  215k
install_bigfix.sh: 208: install_bigfix.sh: firewall-cmd: not found
install_bigfix.sh: 213: install_bigfix.sh: firewall-offline-cmd: not found
install_bigfix.sh: 217: install_bigfix.sh: [[: not found
install_bigfix.sh: 221: install_bigfix.sh: [[: not found
install_bigfix.sh: 234: install_bigfix.sh: [[: not found
jgstew commented 8 years ago

The solution to this is to change the command line that the azure script extension will run to include bash at the start instead of sh

TODO: test this solution

jgstew commented 8 years ago

using bash install_bigfix.sh FQDN_OF_RELAY definitely works for the linux script extention in azure.

I was able to deploy a vm using the script extension and have it show up in BigFix with no further interaction after the vm deployment stuff in azure.