[wplug] crontab problems

Chris Romano romano.chris at gmail.com
Thu Feb 10 10:06:48 EST 2005


On Wed, 9 Feb 2005 22:47:47 -0500, Tom Rhodes <trhodes at freebsd.org> wrote:
> On Wed, 9 Feb 2005 15:45:51 -0500
> Chris Romano <romano.chris at gmail.com> wrote:
> 
> > On Wed, 9 Feb 2005 15:11:42 -0500, Tom Rhodes <trhodes at freebsd.org> wrote:
> > > On Wed, 9 Feb 2005 14:47:13 -0500
> > > Chris Romano <romano.chris at gmail.com> wrote:
> > >
> > > > 1). See previous message
> > > >
> > > > 2). The script doesn't produce any output.
> > > >
> > > > 3). All cron files in /var/log/ are empty.
> > >
> > > Add -x to the top of your script and run it by hand.
> > >
> >
> > Done.  Still no output.
> 
> Probably because you're still sending it to /dev/null, I'm not
> sure if the -x is supposed to override that or not.  Try removing
> those parts from the script.  Remember, they'll send failures
> to /dev/null also.
> 

Remove what parts?

Ok, I now have added this to root's crontab and still nothing.  I
don't know if this helps or not but here you go:

$ cat scripts
#!/bin/bash -x

touch /tmp/t

./yahoo_equ.php
./yahoo_inx.php

$ cat yahoo_equ.php

#!/usr/bin/php
<?php
include "conn.php";

$file = fopen("/home/chris/findata/equ.list","r");
$list = fread($file,2000);
$open = fopen("http://quote.yahoo.com/d/quotes.csv?s=$list&f=sl1d1t1ov&e=.csv",
"r");

$read = fread($open, 2000);
fclose($open);
fclose($file);

$read = str_replace("\"", "", $read);

$stocks = explode("\n",$read);
$sym = explode(",",$_POST[tickersymbol]);
$count = count($stocks);

$db = mysql_connect($host,$user,$pass);
mysql_select_db($dbase,$db);

for ($x=0;$x<$count-2;$x++) {
 $read = explode(",", $stocks[$x]);

 $stamp = date(Ymd,strtotime("$read[2]"));
 $stamp.= date(His,strtotime("$read[3]"));

 $sql = "INSERT INTO equities (id,symbol,price,timestamp,open,volume)
VALUES(NULL,'$read[0]','$read[1]','$stamp','$read[4]','$read[5]')";
 mysql_query($sql);

}
mysql_close($db);
?>

# crontab -l
...
* 9-16 * * Mon-Fri /home/chris/script.sh >> /tmp/tlog.txt 2>&1

Thanks,
Chris


More information about the wplug mailing list