Skip to content

Commit 571b407

Browse files
Add functions to toggle hosts blocking
1 parent 682a6b9 commit 571b407

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

functions

+11-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,18 @@ set-wifi-macaddress() {
5454
}
5555

5656
update-hosts() {
57-
sudo cp -f /etc/hosts /etc/hosts_bck
57+
sudo 'cp' -f /etc/hosts /etc/hosts_bck
5858
wget "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" -O- > /tmp/etc_hosts
5959
cat ~/.hosts >> /tmp/etc_hosts
60-
sudo mv /tmp/etc_hosts /etc/hosts
60+
sudo 'mv' -f /tmp/etc_hosts /etc/hosts_blocking
61+
}
62+
63+
enable-hosts-blocking() {
64+
sudo 'cp' -f /etc/hosts_blocking /etc/hosts
65+
sudo dscacheutil -flushcache
66+
}
67+
68+
disable-hosts-blocking() {
69+
sudo 'cp' -f ~/.hosts /etc/hosts
6170
sudo dscacheutil -flushcache
6271
}

0 commit comments

Comments
 (0)