Sha256: 6c43065101f1b1b4f8cc8bc698ef04149f84fc3b1f6a59240a9fde7afb91ca60

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

die(){
  echo "error: $1" >&2
  exit 1
}

set -e

export HOME=/root
cd "$HOME"

echo "configuring hostname from aws metadata service"
host_title="${AWS_STACK_NAME}-$(echo "${AWS_INSTANCE_LOGICAL_NAME}" | sed 's/LaunchConfiguration$//')"
private_hostname=$(curl -sL http://169.254.169.254/latest/meta-data/local-hostname)
short_private_hostname=$(echo "${private_hostname}" | cut -d'.' -f 1)
echo "${host_title}" > /etc/hostname
hostname -b -F /etc/hostname
sed -i '/127\.0\./d' /etc/hosts
cat >>/etc/hosts <<EOF
127.0.0.1 localhost
127.0.1.1 ${private_hostname} ${host_title} ${short_private_hostname}
EOF


if [ -n "$LOGENTRIES_ACCOUNT_KEY" ]; then
  le clean
  rm -f /etc/default/logentries_not_to_be_run

  echo "starting remote logging"
  host_key=$(docker-utils get-host-uuid "${AWS_INSTANCE_LOGICAL_NAME}.${AWS_STACK_NAME}")

  le init --account-key="${LOGENTRIES_ACCOUNT_KEY}" --agent-key="${host_key}"
  le register --force --name="${host_title}" --hostname="${private_hostname}"
  service logentries start

  logs_to_follow=(syslog messages dmesg auth.log boot.log daemon.log dpkg.log kern.log cron secure faillog cloud-init-output.log)
  for log_name in "${logs_to_follow[@]}"; do
    log_path="/var/log/${log_name}"
    if [ -f "${log_path}" ]; then
      log_name=$(basename "${log_path}" '.log')
      le follow --name="${log_name}" "${log_path}"
    fi
  done

  service logentries restart
fi

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stacco-0.1.41 ./priv/roles/Common.sh
stacco-0.1.40 ./priv/roles/Common.sh
stacco-0.1.39 ./priv/roles/Common.sh
stacco-0.1.38 ./priv/roles/Common.sh