cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl with cronjob

From: Doug McNutt <douglist_at_macnauchtan.com>
Date: Fri, 16 May 2003 19:18:07 -0600

At 08:09 +0800 5/17/03, Andy wrote:
>What is the difference between the way a program runs in a browser or telnet
>window and as a cron job?

There is no standard or error output though some servers convert the same to e-mails if you have other options set up like a .forward address in your home directory. My hosting provider allows execution of perl scripts but nothing else. It's silly because I can enclose a call to curl in back ticks from within perl.

>Is it run as a different user? are rights changed when it runs as a cron
>job?

When, as a user, you use crontab to set up a table it is linked to the user who set it up. Jobs run under that username and his group settings. But. . . The user's login file is typically not executed which means that things like $PATH are not what you might think. Fully qualified path names in the crontab are best.

>We have a user who setup the cron job to retrieve his account information
>from another website using curl in cgi script.The script works fine if it
>runs in web browser or in telnet program but does not when it is run as
>cron.It returns blank data.
>
>curl -s -d "PassPhrase=$pp&AccountID=$account"
>https://www.someurl.com/acct/balance.asp

Personally I would not attempt to use a direct entry to curl from a cron line.. I am on Mac OS neXt and I typically run my cron jobs from Red Hat Linux on a locally networked machine. I pass the path to a tcsh script which in turn calls curl twice. Once to access something on the internet and then again to pass the results to an Apple file server.

curl accesses $HOME/.netrc which is a good way to save names and passwords.

Do set up a log file to which you can "print" or redirect output from curl. Access the log later with telnet or ssh.

Ask off line if you'd like some samples. I am experimenting with one that picks up stock reports every 20 minutes form the AOL instant messenger source. For obvious reasons I don't want to post it here.

-- 
-->  Halloween  == Oct 31 == Dec 25 == Christmas  <--
-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
Received on 2003-05-17