|
Home > Archive > Unix administration > January 2008 > Arguments in Cron Jobs
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Arguments in Cron Jobs
|
|
| GoodMan 2008-01-01, 7:36 am |
| Hello and happy new year to everyone.
I was trying to run a simple cron job on my a certain php script I
have, it runs smoothly.
* * * * * .......... /import.php
But I want to add a "?", "&", "=" and I don't know what other
arguments, the script is done to accept some overrides like so:
* * * * * .......... /import.php?module=import_do_import&override=12
But the cron job like this is not ran at all, and no report whatsoever
is even sent to my mailbox.
Can someone point me towards a solution. Thanks is advance.
| |
| Thorbjoern Ravn Andersen 2008-01-01, 7:36 am |
| GoodMan <shoofionline@gmail.com> writes:
> * * * * * .......... /import.php?module=import_do_import&override=12
It is a quoting problem. I strongly suggest you put these kind of things
in a shell script, to make it easier to debug, and put quotes around the
arguments. Either use ' or ". This is described in any shell script
programming resource.
--
Thorbjørn Ravn Andersen
| |
| Barry Margolin 2008-01-01, 1:28 pm |
| In article
<4505b764-56f0-489f-a2b3-c6e388e78577@v32g2000hsa.googlegroups.com>,
GoodMan <shoofionline@gmail.com> wrote:
> Hello and happy new year to everyone.
>
> I was trying to run a simple cron job on my a certain php script I
> have, it runs smoothly.
>
> * * * * * .......... /import.php
>
> But I want to add a "?", "&", "=" and I don't know what other
> arguments, the script is done to accept some overrides like so:
>
> * * * * * .......... /import.php?module=import_do_import&override=12
>
> But the cron job like this is not ran at all, and no report whatsoever
> is even sent to my mailbox.
>
> Can someone point me towards a solution. Thanks is advance.
It looks like you're trying to use URL syntax. Cron jobs are processed
by the shell, not an HTTP server. Arguments are separated from the
command by whitespace, not "?". Also, "+" characters in the URL
argument string are converted to spaces when executing the command.
I suggest you look up the specification of CGI, the Common Gateway
Interface. It describes all the transformations that take place when a
URL invokes a program.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Charles Polisher 2008-01-02, 7:23 pm |
| GoodMan <shoofionline@gmail.com> wrote:
> Hello and happy new year to everyone.
>
> I was trying to run a simple cron job on my a certain php script I
> have, it runs smoothly.
>
> * * * * * .......... /import.php
>
> But I want to add a "?", "&", "=" and I don't know what other
> arguments, the script is done to accept some overrides like so:
>
> * * * * * .......... /import.php?module=import_do_import&override=12
>
> But the cron job like this is not ran at all, and no report whatsoever
> is even sent to my mailbox.
>
> Can someone point me towards a solution. Thanks is advance.
You need to invoke it as a URL, something like:
* * * * * .......... wget 'http://localhost/import.php?parameters_go_here'
Good luck,
Charles
| |
| Dave Hinz 2008-01-03, 1:45 am |
| On Thu, 03 Jan 2008 00:30:42 -0000, Charles Polisher <cpolish@nonesuch.com> wrote:
> You need to invoke it as a URL, something like:
> * * * * * .......... wget 'http://localhost/import.php?parameters_go_here'
Ugh. I'd rather call a script that handles all the logic than try to
wedge it into a crontab entry. Right tool for the job and all that.
|
|
|
|
|