Skip to content

Instantly share code, notes, and snippets.

@x684867
Last active August 29, 2015 14:07
Show Gist options
  • Save x684867/56a83026fc3dd7886bfb to your computer and use it in GitHub Desktop.
Save x684867/56a83026fc3dd7886bfb to your computer and use it in GitHub Desktop.
#!/bin/bash
[ ! -f ./stackdriver.conf ] && {
$(cat ./stackdriver.conf)
export DEBIAN_FRONTEND=noninteractive;
export APTOPT='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold --force-yes --yes --fix-missing -qq';
curl -s -o /etc/apt/sources.list.d/stackdriver.list https://repo.stackdriver.com/wheezy.list
curl -s --silent https://app.stackdriver.com/RPM-GPG-KEY-stackdriver |apt-key add -
apt-get update -y
apt-get install stackdriver-agent
sudo sed -i -e "s/STACKDRIVER_API_KEY=\"\"/STACKDRIVER_API_KEY=\"\"/' /etc/default/stackdriver-agent
sudo /etc/init.d/stackdriver-agent restart
sudo /etc/init.d/stackdriver-extractor restart
sudo sed -i -e "s/STACKDRIVER_API_KEY=\"\"/STACKDRIVER_API_KEY=\"$STACKDRIVER_KEY\"/"" /etc/default/stackdriver-agent
rm ./stackdriver.conf
echo "success."
exit 0
}
echo "failed. Missing STACKDRIVER_KEY. Please use 'export STACKDRIVER_KEY=\"<APIKEY HERE>\"' and retry."
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment