Last active
January 13, 2017 20:12
-
-
Save lichti/075fd46a9c9934f7c4e10967025bef9b to your computer and use it in GitHub Desktop.
Install newrelic on Wildfly
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
#!/bin/bash | |
#title :wildfly-install-newrelic.sh | |
#description :The script to install newrelic in Wildfly 10.x | |
#usage :/bin/bash wildfly-install-newrelic.sh | |
NR_VERSION=3.34.0 | |
NR_FILENAME=newrelic-java-${NR_VERSION} | |
NR_ARCHIVE_NAME=${NR_FILENAME}.tar.xz | |
NR_DOWNLOAD_ADDRESS=https://www.dropbox.com/s/hslwpa8oyeyqet1/${NR_ARCHIVE_NAME} | |
NR_KEY=${1-'{{NR_KEY}}'} | |
NR_APP=${2-'{{NR_APP}}'} | |
INSTALL_DIR=/opt | |
WILDFLY_DIR=$INSTALL_DIR/wildfly | |
WILDFLY_USER="wildfly" | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root." | |
exit 1 | |
fi | |
wget ${NR_DOWNLOAD_ADDRESS} -O ${INSTALL_DIR}/${NR_ARCHIVE_NAME} | |
tar xJf ${INSTALL_DIR}/${NR_ARCHIVE_NAME} -C ${WILDFLY_DIR} | |
OPTS="JAVA_OPTS=\"\$JAVA_OPTS -javaagent:${WILDFLY_DIR}/${NR_FILENAME}/newrelic/newrelic.jar\"" | |
grep "${OPTS}" ${WILDFLY_DIR}/bin/standalone.conf || echo "${OPTS}" >> ${WILDFLY_DIR}/bin/standalone.conf | |
sed -i "s/{{NR_KEY}}/$NR_KEY/g" ${WILDFLY_DIR}/${NR_FILENAME}/newrelic/newrelic.yml | |
sed -i "s/{{NR_APP}}/$NR_APP/g" ${WILDFLY_DIR}/${NR_FILENAME}/newrelic/newrelic.yml | |
chown -R ${WILDFLY_USER}:${WILDFLY_USER} ${WILDFLY_DIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment