Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@weavenet
Created December 27, 2011 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save weavenet/1524036 to your computer and use it in GitHub Desktop.
Save weavenet/1524036 to your computer and use it in GitHub Desktop.
Disable DNS lookup when starting WEBrick
#!/bin/bash
if [ `whoami` != "root" ]; then
echo "$0 must be run as root."
exit 1
fi
for i in $(locate webrick/config.rb); do
echo "Processing $i"
sed -e 's/^.*:DoNotReverseLookup => nil,$/:DoNotReverseLookup => true,/' $i > /tmp/config.rb
if [ $? -ne 0 ]; then
echo "Error processing file"
exit 1
fi
/bin/cp /tmp/config.rb $i
/bin/rm /tmp/config.rb
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment