Last active
January 3, 2022 08:50
-
-
Save mortenboldt/7ecdba22cc191569c8bdedfebcb6e9ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Run with: curl -s https://gist.githubusercontent.com/mortenboldt/7ecdba22cc191569c8bdedfebcb6e9ad/raw/e68f2436b59c2d5b64f37ab6d0da678bd2abc462/update_solr_log4j.sh | bash -s | |
| VERSION=${1:-2.17.1} | |
| # Download new log4j lib | |
| wget -O /tmp/log4j.tar.gz https://dlcdn.apache.org/logging/log4j/$VERSION/apache-log4j-$VERSION-bin.tar.gz | |
| # Unpack new log4j | |
| tar zxvf /tmp/log4j.tar.gz -C /tmp/ | |
| # Make the solr user own all the new log4j files | |
| chown -R solr:solr /tmp/apache-log4j-$VERSION-bin/ | |
| # Delete old log4j jars | |
| find /opt/solr-7.6.0 -name '*log4j*.jar' -exec rm {} \; | |
| # Copy new log4j jars to solr | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-api-$VERSION.jar /opt/solr-7.6.0/contrib/prometheus-exporter/lib/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-slf4j-impl-$VERSION.jar /opt/solr-7.6.0/contrib/prometheus-exporter/lib/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-core-$VERSION.jar /opt/solr-7.6.0/contrib/prometheus-exporter/lib/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-api-$VERSION.jar /opt/solr-7.6.0/server/lib/ext/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-slf4j-impl-$VERSION.jar /opt/solr-7.6.0/server/lib/ext/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-core-$VERSION.jar /opt/solr-7.6.0/server/lib/ext/ | |
| cp -p /tmp/apache-log4j-$VERSION-bin/log4j-1.2-api-$VERSION.jar /opt/solr-7.6.0/server/lib/ext/ | |
| # Cleanup downloaded files | |
| rm -rf /tmp/log4j.tar.gz | |
| rm -rf /tmp/apache-log4j-$VERSION-bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment