[thelist] cron (specifically the cgi it runs)

Steve Cook sck at biljettpoolen.se
Thu Nov 16 06:20:28 CST 2000

Simply don't print it!

What's happening is that if you do
print "Content-type: text/html\n\n";
on the command line, it will simply print the text in the print statement.
However, if you print the line as part of a cgi script, the cgi mechanism
will interpret the line as an HTTP header. If it's sent before all the rest
of the content, it will send it as an HTTP header, if it's is printed after
a header has already been sent, it will interpret as that you are trying to
send two headers, which triggers an error message to the browser.

What you need is to determine whether the script is running from cgi or from
the command line and not print anything in the command line version. I'm
sure there's an environment variable that details that, but as said earlier,
I don't have any documentation with me, so I'm a little stumped!

Good luck.


   WapWarp - http://wapwarp.com
 Wap-Dev - http://www.wap-dev.net
 Cookstour - http://cookstour.org

> -----Original Message-----
> From: Adrian Fischer [mailto:adrian at logo-logic.com]
> Sent: den 16 november 2000 12:35
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] cron (specifically the cgi it runs)
> Thanks,
> It could be run from either place (I think) but I want it 
> from cron only.
> That being the case,  how do I check and eliminate the  
> Content  header?
> Jon said..<You could just add an extra parameter in the 
> cronjob and check
> for that to
> determine if the Content-type info is necessary.
> >
> Steve said
> >
> > Line 5 of your script, you print our a Content Type header. 
> What you'll
> need
> > to do is check whether your script is being called from cgi 
> or from the
> > command line (the cron version) and make sure that nothing at all is
> printed
> > out for the cron version.
> >
> Adrian Fischer
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list