I created a cron job to trigger a url
at set times, which in turn starts a product import script. But for some reason part of
the trigger url with parameters is stripped
away.
I set the cron job like
this:
/usr/bin/wget -O /dev/null
http://domain.nl/wp-cron.php?import_key=XXXXXXXXXX&import_id=3&action=processing
But
it only runs
http://domain.nl/wp-cron.php?import_key=XXXXXXXXXX
. Where is
the last part that actually tells the script what to
do?
Who knows why it behaves like this and how
to get it to work?
href="https://unix.stackexchange.com/q/86247/29235">The ampersand character
(&
) actually means something in Linux (well, in a
Bourne-compatible shell). It means: run the command as a background
task.
Because of that, you are
actually telling cron to run /usr/bin/wget -O /dev/null
in the background, and
http://domain.nl/wp-cron.php?import_key=XXXXXXXXXX
then to do action=processing
. And that's what cron is doing for
you - what you told it to do.
To get around
this, you need to escape the &
character, so that it gets
processed as part of the url, rather than being interpreted as a control character.
The easiest solution is to
encapsulate the url in quotes.
Comments
Post a Comment