This commit is contained in:
2023-03-04 23:03:47 -06:00
parent bc21928e65
commit 05e41b82a3
2 changed files with 66 additions and 94 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERS='2.02252023' VERS='2.03042023'
MMFOLDER="/opt/idssys/mediamanager" MMFOLDER="/opt/idssys/mediamanager"
MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
@@ -8,7 +8,6 @@ MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
noheader=' check noup stop ' noheader=' check noup stop '
declare -A NM_SERVICES declare -A NM_SERVICES
NM_SERVICES['nordvpn']='NordVPN (VPN Tunnel)'
NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)' NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)'
NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)' NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)'
NM_SERVICES['lidarr']='Lidarr (Music Manager)' NM_SERVICES['lidarr']='Lidarr (Music Manager)'
@@ -21,19 +20,14 @@ NM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)'
NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)' NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)'
NM_SERVICES['ombi']='Ombi (Download Requester)' NM_SERVICES['ombi']='Ombi (Download Requester)'
#if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"10.10.1.24"* ]]; then if [ "${VPN_INTERFACE}" = "tun0" ]; then #openvpn
if [ "${VPN_INTERFACE}" = "nordlynx" ]; then VPN_START=(/bin/systemctl start openvpn)
VPN_STOP=(/bin/systemctl stop openvpn)
# VPN_START=(/usr/bin/nordvpn connect United_States Chicago) else #default wireguard
# VPN_START=(/usr/bin/nordvpn connect us9316) VPN_START=(/usr/bin/wg-quick up ${VPN_INTERFACE})
VPN_START=(/usr/bin/nordvpn c double_vpn) VPN_STOP=(/usr/bin/wg-quick down ${VPN_INTERFACE})
VPN_STOP=(/usr/bin/nordvpn disconnect)
else
#VPN_START=(/bin/systemctl start openvpn)
#VPN_STOP=(/bin/systemctl stop openvpn)
VPN_START=(/usr/bin/wg-quick up wg-torguard)
VPN_STOP=(/usr/bin/wg-quick down wg-torguard)
fi fi
DEBUGLOGSTOP(){ DEBUGLOGSTOP(){

View File

@@ -380,12 +380,6 @@ MMSTOP(){
} }
MMSTATUS(){ MMSTATUS(){
# if [[ ${MMSRV} == *"10.10.1.24"* ]]; then
# statusArray=("nordvpn")
# else
# statusArray=("openvpn")
# fi
#statusArray=(nordvpn openvpn)
statusArray=(wireguard) statusArray=(wireguard)
statusArray+=(${SERVICES_CHECK[@]}) statusArray+=(${SERVICES_CHECK[@]})
echo echo
@@ -395,24 +389,9 @@ MMSTATUS(){
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en " ${NM_SERVICES[${srvc}]}$spc: " echo -en " ${NM_SERVICES[${srvc}]}$spc: "
# if [[ ${MMSRV} == *"10.10.1.24"* ]] && [ "${srvc}" = "nordvpn" ]; then
if [ "${srvc}" = "nordvpn" ]; then
if [[ "$(nordvpn status)" == *"Status: Disconnected"* ]]; then
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
else
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
DIVIDER . lightBlue
nordvpn status
DIVIDER . lightBlue
echo ""
fi
else
if [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then if [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
#OUT=$(ip link | grep "$VPN_INTERFACE")
#if [ ${#OUT} = 0 ]; then
elif [ "${srvc}" == "wireguard" ] && [ "$(ip link | grep $VPN_INTERFACE)" == "" ]; then elif [ "${srvc}" == "wireguard" ] && [ "$(ip link | grep $VPN_INTERFACE)" == "" ]; then
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
@@ -476,7 +455,6 @@ MMSTATUS(){
echo echo
fi fi
fi fi
fi
done done
echo echo