cURL to the Rescue

For reasons mostly lost in the mists of time, we have had a scheduled job on an old Windows 2000 server that launches Internet Explorer with an ASP page. The ASP page does its thing and then closes the browser with a bit of JavaScript. Since the browser is IE 6 this all worked fine.

This week I (finally!) replaced that server with a slightly more modern Windows 2003 server. However, this introduced IE 8 into the equation and it seems that code closing browsers isn’t possible anymore. Or if it is, it involves jumping through way more hoops than my couple hours of research turned up.

So now I had a job that ran once an hour and never went away. This leads to a lot of IE instances piled up!

My first “fix” was to just change the scheduled job to end after 5 minutes. And you know what, it worked just fine. Killed IE 8 dead.

image

However, it put ugly things in the job logs:

"MyJobName" (iexplore) 1/7/2010 8:20:00 AM ** WARNING **
The task was forced to close since its execution time exceeded the configured maximum.
You may want to go to the Settings page and increase the "Stop the scheduled task after" time.

I hate seeing warnings or errors that “don’t count” cluttering up my logs. Justs wastes my time when trouble-shooting or routinely reviewing logs. So while this little hack worked it clearly wasn’t going to be my final solution.

cURL Then I remembered cURL. cURL is your basic open source command line tool and is built to transfer data from servers by URL. Point it at a link and it goes and gets it. Absolutely perfect for what I needed.

curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.

There are versions for a couple dozen operating systems – including Windows. Downloaded it, extracted it to a directory already in the path and modified my scheduled job to “curl” the ASP page.

Problem solved.

Possibly Related posts:

  1. Revisiting Documenting Job Schedules with Google Calendar
  2. Windows Scheduled Tasks Tricks
  3. Microsoft Web-related News
  4. Document Scheduled Jobs with Google Calendar
  5. Wrestling with WSUS Bandwidth


Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>