mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 22:34:11 +02:00
Update run
This commit is contained in:
@@ -5,37 +5,12 @@
|
|||||||
# Wait for transmission to become available
|
# Wait for transmission to become available
|
||||||
bashio::net.wait_for 8080 localhost 900
|
bashio::net.wait_for 8080 localhost 900
|
||||||
|
|
||||||
# Check vpn is working
|
|
||||||
if [ -f /currentip ]; then
|
|
||||||
|
|
||||||
# Get vpn ip
|
|
||||||
if bashio::config.true 'openvpn_alt_mode'; then
|
|
||||||
curl -s ipecho.net/plain > /vpnip
|
|
||||||
else
|
|
||||||
curl -s ipecho.net/plain --interface tun0 > /vpnip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify ip has changed
|
|
||||||
if [[ "$(cat /vpnip)" = "$(cat /currentip)" ]]; then
|
|
||||||
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
|
||||||
bashio::exit.nok
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get ip location
|
|
||||||
COUNTRY=$(curl -s https://ipinfo.io/$(cat /vpnip) | grep country -i -m 1 | cut -d ':' -f 2 |xargs | awk 'gsub(/,$/,x)' || true)
|
|
||||||
|
|
||||||
# Inform by message
|
|
||||||
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
|
|
||||||
# Check vpn is working
|
# Check vpn is working
|
||||||
if [ -f /currentip ]; then
|
if [ -f /currentip ]; then
|
||||||
exec nginx & \
|
exec nginx & \
|
||||||
while true; do
|
while true; do
|
||||||
sleep 15m
|
|
||||||
# Get vpn ip
|
# Get vpn ip
|
||||||
if bashio::config.true 'openvpn_alt_mode'; then
|
if bashio::config.true 'openvpn_alt_mode'; then
|
||||||
curl -s ipecho.net/plain > /vpnip
|
curl -s ipecho.net/plain > /vpnip
|
||||||
@@ -48,6 +23,16 @@ if [ -f /currentip ]; then
|
|||||||
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
||||||
bashio::exit.nok
|
bashio::exit.nok
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get ip location
|
||||||
|
COUNTRY=$(curl -s https://ipinfo.io/$(cat /vpnip) | grep country -i -m 1 | cut -d ':' -f 2 |xargs | awk 'gsub(/,$/,x)' || true)
|
||||||
|
|
||||||
|
# Inform by message
|
||||||
|
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY"
|
||||||
|
|
||||||
|
# Check every 15m
|
||||||
|
sleep 15m
|
||||||
|
|
||||||
true
|
true
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user