Difference between revisions of "NXFilter"

From Michael's Information Zone
Jump to navigation Jump to search
Line 48: Line 48:
 
echo "The version downloaded is $zip. Do you want to continue?"
 
echo "The version downloaded is $zip. Do you want to continue?"
 
read -s answer
 
read -s answer
if [ "$answer" = "n" ]; then
+
if [ "$answer" != "y" ]; then
 
exit 1
 
exit 1
 
else
 
else

Revision as of 12:55, 26 January 2017

Install

Update Shallalist

This script assumes you have a systemd entry for nxfilter called nxfilter. Also you will need to add the following to the end of your update.sh script "systemctl start nxfilter"

NOTE : Edit to fit your environment

systemctl stop nxfilter
state=$(systemctl --all | grep nxfilter)
if grep -q running <<< $state; then
#echo "Still Running"
sleep 5
exec /<script location>/nxupdate.sh
else
cd /<installdirectory>/bin/
#pwd
exec /<installdirectory>/bin/update_sh.sh
fi

Systemd Unit File

Make sure to modify the unit file to fit your environment.
/etc/systemd/system/nxfilter.service

[Unit]
Description=NXFilter startup script
After=network.target

[Service]
Type=simple
ExecStart=/<installdirectory>/bin/startup.sh
ExecStop=/<installdirectory>/bin/shutdown.sh

[Install]
WantedBy=default.target

Upgrade

Copy the URL from the NXFilter site to use with the script
nxupgrade.sh https://nxfilter......

#!/bin/bash
wget "$1" &> /tmp/wgetnxfilter
grep "Saving to:" /tmp/wgetnxfilter > /tmp/wgetnxfilter2
sed -i "s/\’//" /tmp/wgetnxfilter2
sed -i "s/\‘//" /tmp/wgetnxfilter2
rm -f /tmp/wgetnxfilter
sed -i 's/^Saving\ to:\ //' /tmp/wgetnxfilter2
zip=$(cat /tmp/wgetnxfilter2)
rm -f /tmp/wgetnxfilter2
echo "The version downloaded is $zip. Do you want to continue?"
read -s answer
if [ "$answer" != "y" ]; then
	exit 1
else
	systemctl stop nxfilter
	unzip $zip
	echo "systemctl start nxfilter" >> /<install directory>/bin/update_sh.sh
	chmod +x /<install directory>/bin/update_sh.sh
	chmod +x /<install directory>/bin/shutdown.sh
	chmod +x /<install directory>/bin/startup.sh
	systemctl start nxfilter
fi