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.
|
|
0
|
|
|
|
Reply
|
GoodMan
|
1/1/2008 8:07:39 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
|
|
0
|
|
|
|
Reply
|
Thorbjoern
|
1/1/2008 10:19:25 AM
|
|
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 ***
|
|
0
|
|
|
|
Reply
|
Barry
|
1/1/2008 5:12:38 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
|
|
0
|
|
|
|
Reply
|
Charles
|
1/3/2008 12:30:42 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.
|
|
0
|
|
|
|
Reply
|
Dave
|
1/3/2008 2:02:04 AM
|
|
GoodMan <shoofionl...@gmail.com> wrote:
>
> 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.
Just to include those characters you need to escape them with
backslash but it is very unlikely it will work. Chances are it will
result in file-not-found error.
> Can someone point me towards a solution.
man getopt
for how to pass arguments to scripts. You want to write a script
that takes switches on its command line then generates the web
type of arguments.
|
|
0
|
|
|
|
Reply
|
Doug
|
1/7/2008 7:54:36 PM
|
|
Thanks for all the help! I ended writing a small script and executing
it. In my opinion it's a lot better than invoking a URL, so mainly I
did as Thorbjoern Ravn Andersen and Doug Freyburger wrote. So if
anyone encounters the same problem, I suggest using the same method.
|
|
0
|
|
|
|
Reply
|
GoodMan
|
1/12/2008 8:15:44 AM
|
|
GoodMan wrote:
>
> Thanks for all the help! I ended writing a small script and executing
> it. In my opinion it's a lot better than invoking a URL, so mainly I
> did as Thorbjoern Ravn Andersen and Doug Freyburger wrote. So if
> anyone encounters the same problem, I suggest using the same method.
I read in another newsgroup that for cron jobs, things like .profile may
not get executed in some UN*Xes with the result that the process
environment is different under cron than it would be in an "at" job or
when a script is run interactively.
A poster in that group (comp.unix.aix) suggested having a "template
script" that you submit to cron, and have that template script invoke
such things as .profile or otherwise provide any environment setup that
might otherwise be missing under cron before invoking the script you
want to execute, whose name is passed to the template script as a
command line argument in the crontab entry.
For what little it may be worth...
David J Dachtera
DJE Systems
|
|
0
|
|
|
|
Reply
|
David
|
1/13/2008 2:46:05 AM
|
|
|
7 Replies
232 Views
(page loaded in 0.06 seconds)
|