CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
:: Running script from Crontab

 



Thierry
Deleted

Mar 12, 2000, 4:26 AM

Post #1 of 5 (1219 views)
:: Running script from Crontab Can't Post

#print "Content-type: text/html\n\n";
use LWP::Simple;
$doc = get "http://abcnews.go.com/";;
@abc=split(/\n/,$doc);
$rcd=0;
$news="";
foreach $line (@abc){
$ft=substr "$line","",7;
if($rcd==1){
if($line!~/font/){
if($ft ne '<!-- Po'){
$news="$news\n<tr><td valign=top><font size=-1></font></td><td valign=top>$line</td></tr>";
}
}else{
if($line!~/<\/font>/){
$news="$news\n$line";
}
}
}
if ($ft eq '<B>P O '){
$rcd=1;
}elsif($ft eq '</font>'){
$rcd=0;
}
}
$logpath = "../../catpol.txt";
open (LOG, ">$logpath");

print LOG "<table border=0 cellpadding=0 cellspacing=2>\n";
$news=~s/html\">/html\"><font size=-1>/gi;
$news=~s/<\/a>/<\/a><\/font>/gi;
print LOG "Politics<br>$news</td></tr>";
print LOG "<tr><td colspan=2></td></tr><tr><td colspan=2></center></p></td></tr>\n";
print LOG "</table>\n";
close(LOG);
exit;


If i run it from my browser it writes to that file. If i enter it as a job for crontab it does not print anything to that file ?

Somebody may explain this to me, please.

Thierry Zoller


Jasmine
Administrator

Mar 22, 2000, 4:15 AM

Post #2 of 5 (1219 views)
Re: :: Running script from Crontab [In reply to] Can't Post

Since the code looks good at first glance, I guess the question of the hour is if the crontab's working properly. Usually, when cron invokes a program that fails, it sends the "admin" an email with the error message (instead of STDOUT). If you're not getting an error email, you can try changing that email address as discussed at http://www.perlarchive.com/tlc/0001/04.shtml

You may wish to post your cron entry to see if that may be the problem.

Also, if you have access to your error logs, please post the error specific to the program.


Thierry
Deleted

Mar 23, 2000, 7:49 AM

Post #3 of 5 (1219 views)
Re: :: Running script from Crontab [In reply to] Can't Post

Thanks for the reply.

The problem is there is no error message. As you stated cron sends mail to the admin if something goes wrong, and it did, but not in this case.

Possible you try it on your server ?


Jasmine
Administrator

Mar 23, 2000, 8:09 AM

Post #4 of 5 (1219 views)
Re: :: Running script from Crontab [In reply to] Can't Post

I have no doubt the program works -- it's cron that I'm curious about. What entry did you put into cron for this program?


Thierry
Deleted

Mar 23, 2000, 8:39 AM

Post #5 of 5 (1219 views)
Re: :: Running script from Crontab [In reply to] Can't Post

*/45 * * * * /home/waatleef/public_html/cgi-bin/newsg/wortcron.pl

There is no problem with cron, it does run what i tell it to run.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives