NXFilter

From Michael's Information Zone
Revision as of 17:24, 18 January 2017 by Michael.mast (talk | contribs) (Created page with "==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....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 answer
if "$answer" == "n"; 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