Last active
February 25, 2019 13:37
-
-
Save foospidy/ec91df7682ee3872deeafbc8734a5d60 to your computer and use it in GitHub Desktop.
honeydb-agent install script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Installs/upgrades the latest version of honeydb-agent. | |
# An existing configuration will be backed up, and applied | |
# to the new install/upgrade. | |
# | |
# sudo ./honeydb-agent-install.sh | |
# | |
ARCHITECTURE=`uname -m` | |
# backup config if needed | |
mkdir -p .honeydb-agent-backup | |
if [ -d /etc/honeydb ]; | |
then | |
cp /etc/honeydb/* .honeydb-agent-backup/ | |
fi | |
# check for curl, install if needed | |
if [ -z `which curl` ]; | |
then | |
apt-get update | |
apt-get install -y curl | |
fi | |
# setup repo if needed | |
if [ ! -f /etc/apt/sources.list.d/honeydb-honeydb-agent.list ]; | |
then | |
curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/setup/bash.deb.sh' | bash | |
#apt-get install -y debian-keyring | |
#apt-get install -y debian-archive-keyring | |
#apt-get install -y apt-transport-https | |
#curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/gpg/gpg.305CBD56E3FE07CA.key' | apt-key add - | |
#curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/setup/config.deb.txt?codename=jessie&distro=debian' > /etc/apt/sources.list.d/honeydb-honeydb-agent.list | |
#apt-get update | |
fi | |
# get latest agent | |
apt-get -y install honeydb-agent | |
# clean up | |
apt-get -y autoremove | |
# restore config | |
if [ -f .honeydb-agent-backup/agent.conf ]; | |
then | |
cp .honeydb-agent-backup/* /etc/honeydb/ | |
fi | |
# restart agent | |
service honeydb-agent restart | |
systemctl honeydb-agent restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment