smeserver-unifi/root/sbin/e-smith/systemd/unifi

29 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash
# check if squid is using 8080, if yes, then move to 8081
intercept=$(/usr/sbin/e-smith/config getprop squid InterceptPort||echo "8080")
squidstatus=$(/usr/sbin/e-smith/config getprop squid status||echo "disabled")
if [[ "$intercept" == "8080" && "$squidstatus" == "enabled" ]]; then
echo "we set squid Intercept port to 8081.. to avoid conflict with unifi "
/usr/sbin/e-smith/config setprop squid InterceptPort 8081
/usr/sbin/e-smith/expand-template /etc/squid/squid.conf
/usr/sbin/e-smith/expand-template /etc/rc.d/init.d/masq
/usr/bin/systemctl restart squid
/usr/bin/systemctl restart masq
fi
# now deal with dansguardian
dport=$(/usr/sbin/e-smith/config getprop dansguardian port ||echo "8080")
dstatus=$(/usr/sbin/e-smith/config getprop dansguardian status||echo "disabled")
if [[ "$dport" == "8080" && "$dsatus" == "enabled" ]]; then
echo "we set dansguardian port to 8081.. to avoid conflict with unifi "
/usr/sbin/e-smith/config setprop dansguardian port 8081
/usr/sbin/e-smith/expand-template /etc/dansguardian/dansguardian.conf
/usr/bin/systemctl restart dansguardian
fi
# nothing to do with with squidguard