📝 Made notes and adjustments for wireguard setup

This commit is contained in:
tomit4 2025-08-18 18:15:13 -07:00
parent e51059574b
commit 18194e2263
2 changed files with 34 additions and 4 deletions

View file

@ -1,13 +1,26 @@
#!/usr/bin/env bash
# OpenVPN Setup
# main() {
# if pgrep -x "openvpn" >/dev/null; then
# IPV4=$(ip addr show dev tun0 | grep inet | awk '{print $2}' | cut -d/ -f1 | head -n 1)
# $(which rtorrent) -b "$IPV4"
# else
# echo "openvpn is not running. please start your VPN first."
# exit 1
# fi
# }
# Wireguard Setup
IFACE=$(wg show interfaces | awk '{print $1}')
main() {
if pgrep -x "openvpn" >/dev/null; then
IPV4=$(ip addr show dev tun0 | grep inet | awk '{print $2}' | cut -d/ -f1 | head -n 1)
if ip link show "$IFACE" up >/dev/null 2>&1; then
IPV4=$(ip -4 addr show dev "$IFACE" | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1)
$(which rtorrent) -b "$IPV4"
else
echo "openvpn is not running. please start your VPN first."
echo "wireguard interface $IFACE is not up. please start your VPN first."
exit 1
fi
}
main
main