[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Cron/ASP



on 5/20/02 1:38 PM, Jay Summers at jay@xxxxxxxxxxxxxxxxxxxxx wrote:

>> i'm trying to setup a cron.hourly file to run an asp script. it doesn't seem
>> to recognise my script as asp. i'm assuming i need to specify that in the
>> cron file but i have no idea how to do this.
> 
> Disclaimer: I have no ASP experience.
> 
> With that said, I think the problem is that cron isn't capable of parsing
> your asp. If i set up a cron job to run a perl script I have, I would have
> to specify what to parse it with.
> i.e.
> perl /path/to/myperl.cgi
> 
> The above would be the text I would put in a file, make executable and drop
> into cron.hourly. Then every hour it would call perl to parse myperl.cgi.
> 
> I'm not sure how asp works on the raq so maybe someone else will chime in
> with an idea.
> 

Well, if you don't want to rewrite the asp, just write a simple perl script
to call up the asp page via LWP and run the perl via cron as suggested
above.  Here's an example to get you started:

#!/usr/bin/perl -w

use strict;

# Create a user agent object
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

# Create a request
my $req = new HTTP::Request GET => 'http://www.google.com/';

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
    print $res->content;
} else {
    print "Bad luck this time\n";
}




-- 
Olaf Alders

olaf@xxxxxxxxxxxxxxx
http://vilerichard.com

Wed, June 5th -- Vile Richard @ Reverb (Queen and Bathurst, Toronto)