Cron Job URL Encoding


#1

I can’t seem to get the cron job to hit the following URL and I’m wondering if it’s because the URL contains an ampersand.

URL (# is actual numbers): /home/.myserver/myusername/mydomain.com/wp-content/plugins/fotobook/cron.php?secret=#######&update

I tried encoding the ampersand to the entity code ( & amp ; [spaces entered so that the code isn’t turned into the sign]) but still the cron job can’t find the file. Also, the error message says “update: command not found.”

Is this a problem with the Wordpress Fotobook plugin or Dreamhost or my URL?

Thanks!


#2

Try putting the entire command in single quotes, or put a backslash () in front of the ampersand.

-Scott


#3

[quote]I can’t seem to get the cron job to hit the following URL and I’m wondering if it’s because the URL contains an ampersand.

URL (# is actual numbers): /home/.myserver/myusername/mydomain.com/wp-content/plugins/fotobook/cron.php?secret=#######&update

I tried encoding the ampersand to the entity code ( & amp ; [spaces entered so that the code isn’t turned into the sign]) but still the cron job can’t find the file. Also, the error message says “update: command not found.”

Is this a problem with the Wordpress Fotobook plugin or Dreamhost or my URL?

Thanks![/quote]

Eleazar, it helps to pay attention to what the system is asking for :wink: It wants a command, not a URL. Besides that, you mixed things up. You start out with a filesystem path (/home/.myserver/myusername/mydomain.com/wp-content/plugins/fotobook/cron.php) but sorry - it doesn’t magically turn into a URL by adding a query string to the end.

A command that starts a program is often just the name of the program or the entire path to the program file. Just like your own computer needs a browser to visit a web site URL, you need to start a program that can visit a web site URL in your cron job. You pass the actual URL to visit as an argument to the program in the command.

The command you want to run would be
wget --delete-after “http://mydomain.com/wp-content/plugins/fotobook/cron.php?secret=#######&update

So in the command we are running the program called ‘wget’ and passing to it 2 arguments.

Normally wget will show status information and save the content to a file. The optional ‘–delete-after’ argument will cause it to delete the file when it is done.

Hope this helps.

:cool: openvein.org -//-


#4

Atropos7,

You rock. Thanks for the clear explanation and final command. I feel really embarrassed now. No wonder the computer was confused! I was feeding it absolute junk. Haha. =/

Thanks again!


#5

Yeah, I meant “Do the wget thing.”

-Scott