Skip to content

Instantly share code, notes, and snippets.

@jorgecasas
jorgecasas / 02updatehosts
Created March 1, 2016 08:35
Linux - Change hosts file automatically depending on WiFi
#!/bin/sh
# Script to change hosts file when your router does not allow ip loopback
#
# Save it in /etc/NetworkManager/dispatcher.d
wifi=`iwgetid -r`;
if [ $wifi = 'ESSID_WIFI' ];
then
cat /etc/hosts.common /etc/hosts.in > /etc/hosts