Script to Download
Of course I wanted to help my colleague, on the other hand I do not want to stay back either. Also, I do not want to leave my notebook unattended
in the office. If I would capture the HTTP headers at the final click, I should be able replay that as a script. With this approach, the script does not have to worry about session. I launched
LiveHTTPheaders to assist me to capture the HTTP headers. Below is the screen capture:
To prove that my concept works, I captured all these HTTP headers and put them in a script to program Wget to download it for me in a Solaris server. Instead of running the script with nohup and puting it as a background job, I ran that as a batch process using "at now". If you were to run with 'nohup command ... &', you wouldn't be able to logout cleanly from your connection. Here is how I scripted the whole thing
#! /bin/sh h1='Host: sdlc-esd.sun.com' h2='User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9' h3='Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' h4='Accept-Language: en-us,en;q=0.5' h5='Accept-Encoding: gzip,deflate' h6='Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' h7='Cookie: s_cc=true; s_sq=; SessionCredentials=6664883992855580291' url='http://sdlc-esd.sun.com/ESD24/Java_Systems/AS7U9/sun-appserver7-solaris-sparc-ur9.tar.gz?AuthParam=1195746732_f8c9c901546df8b1985446441554100c&TUrl=an1npDpbKod7kSYrROhENTonIuc5W0D1Lc4nXz+pGFFranixdCdgxDTPbW4=&TicketId=dVN4Og5LN+k6+w==&GroupName=SDLC&BHost=sdlc3h.sun.com&FilePath=/ESD24/Java_Systems/AS7U9/sun-appserver7-solaris-sparc-ur9.tar.gz&File=sun-appserver7-solaris-sparc-ur9.tar.gz' wget \ --header="$h1" \ --header="$h2" \ --header="$h3" \ --header="$h4" \ --header="$h5" \ --header="$h6" \ --header="$h7" \ -O sun-appserver7-solaris-sparc-ur9.tar.gz \ "$url"
Shell script saved the day.
Labels: shell script, wget
1 Comments:
This technique is really cool :-)
Post a Comment
<< Home