Created
May 4, 2014 04:05
-
-
Save voodoojello/0ab7cf25862241690146 to your computer and use it in GitHub Desktop.
This script will download the current blacklist tarball from Shalla, extract it, stop NxFilter, call the nxd.ShallaUpdate import, restart the service, and clean up the mess.
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/sh | |
# | |
# Shallalist Downloader for NxFilter | |
# Mark Page [m.e.page_at_gmail.com] | |
# modified: Mon Apr 28 20:34:59 CDT 2014 | |
# | |
# This script will download the current blacklist | |
# tarball from Shalla, extract it, stop NxFilter, | |
# call the nxd.ShallaUpdate import, restart the | |
# service, and clean up the mess. | |
# | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# | |
# NxFilter installation location and Java heap | |
# size options. Change as needed. | |
# | |
export NX_HOME=/opt/nxfilter | |
export JVM_HEAP="512m" | |
export PATH=$PATH:/usr/bin:/usr/local/bin | |
if [ ! -f "$NX_HOME/nxd.jar" ]; then | |
echo "\n ERROR! NxFilter environment not found at \"$NX_HOME\"!" | |
echo " - Set the NX_HOME var for this script to NxFilter's application directory and try again.\n" | |
exit 1 | |
fi | |
echo "Downloading from Shallalist..." | |
cd /tmp | |
wget http://www.shallalist.de/Downloads/shallalist.tar.gz | |
echo "Extracting shallalist.tar.gz..." | |
tar -xf shallalist.tar.gz | |
echo "Stopping NxFilter Service..." | |
service nxfilter stop | |
sleep 5 | |
NX_UPDATE="-Djava.net.preferIPv4Stack=true -Xmx$JVM_HEAP -Djava.security.egd=file:/dev/./urandom -cp $NX_HOME/nxd.jar:$NX_HOME//lib/*: nxd.ShallaUpdate /tmp/BL" | |
cd $NX_HOME | |
echo "Importing Categories..." | |
/usr/bin/java $NX_UPDATE | |
echo "Restarting Service..." | |
service nxfilter start | |
echo "Cleaning up..." | |
rm -r -f /tmp/BL | |
rm -f /tmp/shallalist.tar.gz | |
echo "Done." | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment