[lug] Shell/Cron and passing args

Andrew Gilmore agilmore at uc.usbr.gov
Thu Jan 30 13:27:05 MST 2003


I think he really needs a pipe instead...

01 00 * * * /path/to/make_featured.php links | /path/to/phpbin > 
/path/to/log/cron 2>&1

May work better. I didn't catch that you were using a redirect from 
another script. That won't work at all. And if you omit the argument, 
you'll just get the file contents directed.

This jsut comes down to the fact that the shell doesn't expect a command 
as the input to <

Good luck.

Andrew


Chip Atkinson wrote:
> Hi John.
> 
> Are you trying to take the output of make_featured.php with an argument of
> links?  If so, you probably want to use back ticks.  I believe that cron
> uses sh rather than bash.
> 
> Chip
> 
>  On 30 Jan 2003, John Starkey wrote:
> 
> 
>>Hello all. I've got a PHP shell script that I'm running perfectly fine
>>in a normal shell, but I can't get it to run with cron.
>>
>>Basically, it's a script that writes several includes for a web page.
>>Each are fairly common, so I've got one script and I'm trying to pass it
>>arguments, with different cron entries. I can pass the arguments fine in
>>a shell, but cron isn't happy.
>>
>>This is the shell command:
>>
>>/path/to/make_featured.php links
>>
>>no problem. But if I do:
>>
>>01 00 * * * /path/to/phpbin < /path/to/make_featured.php links >
>>/path/to/log/cron 2>&1
>>
>>it fails saying the argument 'links' isn't seen.
>>
>>The only fix I can find is to create a bash wrapper for it. Does anyone
>>know what I'm doing wrong, before I create 2 scripts to do the work of
>>one?
>>
>>Thanks much,
>>
>>John
>>
>>
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> 




More information about the LUG mailing list