-
-
Save therobot/753068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# lets. A productivity booster | |
# based on ideas from https://gist.github.com/605292 | |
# | |
# Copy your /etc/hosts to /etc/hosts.play and create a new one called /etc/hosts.work with a list of blocked sites | |
# Usage: sudo lets [play|work] | |
if [ $# = 0 ] | |
then | |
echo "Don't know what I must do!" >&2 | |
exit 1 | |
fi | |
if [ $UID -ne 0 ] | |
then | |
echo "Use me with sudo!" >&2 | |
exit 2 | |
fi | |
HOSTS=/etc/hosts | |
ORIGIN="$HOSTS.$1" | |
if [ -e $ORIGIN ] | |
then # Let's do something!! | |
if [ `uname` = Darwin ] | |
then | |
FLUSH="$(which dscacheutil) -flushcache" | |
fi | |
rm $HOSTS && cp $ORIGIN $HOSTS && echo "Let's $1!" | |
$FLUSH | |
else | |
echo "Ooops, don't know how to do $1!" | |
exit 3 | |
fi |
Creo que en linux sólo hay que limpiarla si hay un servidor de cache instalado. Habría que comprobar eso.
http://www.ubuntugeek.com/howto-clearflush-dns-cache-in-ubuntu.html
Por otro lado, recuerdo que había alguien que había hecho ya esto, pero ahora no encuentro en enlace.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Me gusta la idea. Habria que buscar algo que pueda identificar un linux y buscar el comando para limpiar caches de DNS (si hay alguno estandar o tal cosa existe en linux)