February 2011

HOW TO : Setup Global Redirect in Lighttpd

If you have ever managed a web application, you know you have to take it down at times :). And you usually want to show an simple page stating that you are down for maintenance. Here is a simple way to setup a “maintenance” splash page. The assumption is that you have a Linux server to host the maintenance page.

  • Configure lighttpd (HTTP Server) on the server using instructions from this article on Cyberciti.
  • Edit the lighttpd.conf file and add the following line in your site configuration

[bash] server.error-handler-404   = "index.html" [/bash]

  • Name your maintenance page as index.html and upload it to the document root (in this example, it is /var/www/html)

You are essentially telling the web server to display index.html whenever the user is trying to access content that is not present on the server. And since there is no content on the server other than the index.html, the web browser will always display the index.html page..

HOW TO : Dowload content from Oracle Metalink (Support) using wget

The usual process for a DBA to download files from Oracle Metalink (support) site is

  • Login to Metalink from his/her workstation
  • Download the file
  • Upload the file to the database server
  • Use the file

Say your database is in a data center and your workstation doesn’t have high speed connectivity to the data center, you can use the following trick to download content to a l[u]inux server in the data center that has Internet connectivity (and hopefully it is not your database server 🙂 ).

  • Log into Metalink from your workstation
  • Grab the link to the file/content you want to download (for example, we recently tried to download clusterware for Oracle 11G, and the link was http://download.oracle.com/otn/linux/oracle11g/linux.x64_11gR1_clusterware.zip)
  • Log into a server in your data center (it should have connectivity to the Internet and also to your database server)
  • Download the file using wget

[bash]wget http://download.oracle.com/otn/linux/oracle11g/linux.x64_11gR2_clusterware.zip –user ORACLE_ID –password ORACLE_ID_PASSWORD[/bash]

  • Replace the link with the link to your content and use your Oracle ID and password.
  • The file downloaded will have a strange name since wget  appends the sessionID to the end of the file. In the example I used above, the name of the file was “linux.x64_11gR2_clusterware.zip\?e\=1297470492\&h\=a66b265cc967a68c611052cb8e54356f
  • Rename the file and strip off the unnecessary data in the name using mv

HOW TO : Capture HTTP Headers using tcpdump

Quick how to on capturing HTTP headers using tcpdump on a web server (running Linux).

    • On the web server, issue the following command

      [bash] tcpdump -s 1024 -C 1024000 -w /tmp/httpcapture dst port 80 [/bash]

        • Stop the capture by issuing the break command (ctrl + c)
        • Open the capture file (httpcapture in this example) in wireshark and check out the headers under the  the HTTP protocol

        Overheard : Comment about being a true Motivater

        I was interviewing a candidate for a job opening at my work. I asked him how he motivates his team and he made this comment about how you truly measure if you can motivate a person

        Think of a 16 year old working part time at a retailer. She is just working to earn money to buy some lipstick or perfume. Think how you can motivate her to work on a thanksgiving weekend!!

        RESOLUTIONS : 2011 : January Update

        As I mentioned here, I have made some resolutions for 2011. As with any good task list, it is worthless unless you take a look at it periodically and update it :). I am going to publish an update on each one of the resolutions every month. Here goes the first one

        1. Loose weight (AKA loose gut)
          • I am practicing part of the diet proposed by Tim Ferris in his Four Hour Body book. I am eating 2 egg whites for breakfast and than eating a small meal every 4 hours. I haven’t gone completely into the whole “white” carb diet he proposes though.
          • I also started tracking my weight and diet religiously on a daily basis. This is another of Tim’s ideas. He says that by tracking your weight everyday, you subconsciously start making better choices in terms of the food you eat. I this it makes sense :). I am tracking the data in a Google spreadsheet. Here is a chart of my weight for the last one month I started out at 194 lbs and am not at 188 lbs. Hopefully I will be able to keep this downward trend.
          • I also started working out (thanks to Jhanvi). We are working out at least 2 times a week.
        2. Increase web traffic to kudithipudi.org
          • I started posting more content on the site. I posted 8 articles in January.
          • No particular strategy other than writing more content, which will hopefully bring more traffic.
          • Have the following topics to write on (and some of them have been pending for a long time)
            • Moving your life to the cloud
            • Setting up a virtual server on the Rackspace Cloud Infrastructure
            • Configuring syslog-ng
            • Configuring nginx to reduce resource utilization on Linux server
        3. Achieve CISSP certification
          • No progress on this one at all.
        4. Go on a vacation
          • Jhanvi and I planned to go to the travel and adventure expo, that was held in Rosemont last weekend, but we got too lazy :).
          • Our trip to India (and it doesn’t count as a vacation 🙁 ) is planned for April.

        Progress on 2 out of the 4 resolutions!!.. Not bad :).

        PS : Thanks for all the support I have been getting on the first resolution :). I didn’t realize the situation was so bad :).