added mullvad reconnect on dns failure script
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# network utility functions
|
||||
|
||||
# get the ip address of the host
|
||||
function get_local_ip() {
|
||||
echo -e "The interfaces and IPs are:\n$(ip -o -4 addr show | awk '/inet 192.168|inet 10.|inet 172.16/ {split($4, a, "/"); print $2 ": " a[1] "\n"}')"
|
||||
}
|
||||
|
||||
function get_public_ip() {
|
||||
public_ip=$(curl -s canhazip.com)
|
||||
echo -e "The public IP is: $public_ip"
|
||||
}
|
||||
|
||||
function is_dns_working() {
|
||||
dns_working=$(ping -c 1 google.com | grep "1 received" | wc -l)
|
||||
if [ $dns_working -eq 1 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
function reconnect_vpn_on_dns_failure() {
|
||||
# reconnect vpn if dns is not working
|
||||
if ! is_dns_working; then
|
||||
echo "DNS is not working, reconnecting VPN"
|
||||
mullvad reconnect
|
||||
else
|
||||
echo "DNS is working, no need to reconnect VPN"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# script for updating all packages but excluding a list of packages
|
||||
|
||||
# set path to list of packages to exclude
|
||||
exclude_list_file=~/.setup/packages/exclude_from_updating.list
|
||||
|
||||
# load list of packages to exclude
|
||||
exclude_list=$(cat $exclude_list_file)
|
||||
|
||||
# define function that calls yay update and excludes packages from exclude_list
|
||||
|
||||
function update_system {
|
||||
yay -Syu --noconfirm --needed --noprovides --ignore $exclude_list
|
||||
}
|
||||
|
||||
# also define function that only updates packages from pacman
|
||||
function update_pacman_packages {
|
||||
sudo pacman -Syu --noconfirm --needed --noprovides --ignore $exclude_list
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user