OMS-docker/1.3.4-127b/main.sh

47 строки
1.9 KiB
Bash

#!/bin/bash -x
sed -i -e 's/bind 127.0.0.1/bind 0.0.0.0/g' /etc/opt/microsoft/omsagent/sysconf/omsagent.d/container.conf
sed -i -e 's/bind 127.0.0.1/bind 0.0.0.0/g' /etc/opt/microsoft/omsagent/sysconf/omsagent.d/syslog.conf
sed -i -e 's/^exit 101$/exit 0/g' /usr/sbin/policy-rc.d
#Using the get_hostname for hostname instead of the host field in syslog messages
sed -i.bak "s/record\[\"Host\"\] = hostname/record\[\"Host\"\] = OMS::Common.get_hostname/" /opt/microsoft/omsagent/plugin/filter_syslog.rb
#service omid start
/opt/omi/bin/service_control start
if [ -z $INT ]; then
if [ -a /etc/omsagent-secret/DOMAIN ]; then
/opt/microsoft/omsagent/bin/omsadmin.sh -w `cat /etc/omsagent-secret/WSID` -s `cat /etc/omsagent-secret/KEY` -d `cat /etc/omsagent-secret/DOMAIN`
elif [ -a /etc/omsagent-secret/WSID ]; then
/opt/microsoft/omsagent/bin/omsadmin.sh -w `cat /etc/omsagent-secret/WSID` -s `cat /etc/omsagent-secret/KEY`
elif [ -a /run/secrets/DOMAIN ]; then
/opt/microsoft/omsagent/bin/omsadmin.sh -w `cat /run/secrets/WSID` -s `cat /run/secrets/KEY` -d `cat /run/secrets/DOMAIN`
elif [ -a /run/secrets/WSID ]; then
/opt/microsoft/omsagent/bin/omsadmin.sh -w `cat /run/secrets/WSID` -s `cat /run/secrets/KEY`
elif [ -z $DOMAIN ]; then
/opt/microsoft/omsagent/bin/omsadmin.sh -w $WSID -s $KEY
else
/opt/microsoft/omsagent/bin/omsadmin.sh -w $WSID -s $KEY -d $DOMAIN
fi
else
echo WORKSPACE_ID=$WSID > /etc/omsagent-onboard.conf
echo SHARED_KEY=$KEY >> /etc/omsagent-onboard.conf
/opt/microsoft/omsagent/bin/omsadmin.sh
fi
#service omsagent start
/opt/microsoft/omsagent/bin/service_control start
#/opt/microsoft/omsconfig/Scripts/OMS_MetaConfigHelper.py --disable
#rm -f /etc/opt/microsoft/omsagent/conf/omsagent.d/omsconfig.consistencyinvoker.conf
shutdown() {
/opt/omi/bin/service_control stop
/opt/microsoft/omsagent/bin/service_control stop
}
trap "shutdown" SIGTERM
sleep inf & wait