Author Topic: Cron job  (Read 6989 times)

pogge

  • Senior Member
  • *****
  • Posts: 4285
    • View Profile
    • Peace, order and good government, eh?
Re: Cron job
« Reply #15 on: November 10, 2006, 12:09:42 PM »
Quote from: Debra
25 * * * * cd $HOME/www/wp/wp-content ; php -q update-feeds.php


I imagine Mandos knows this already but to explain some of this:

25 * * * * = run this job at 25 minutes past the hour, every hour, every day of the month, every month, every day of the week. Your host is providing a graphical interface for specifying these values, so you would use it and omit this part from the command line field.

cd $HOME/www/wp/wp-content = set the working directory. cd is the linux/unix (and DOS) command for changing directories (folders for those who only know windows).

php -q update-feeds.php = the actual command. It looks like it's calling the php interpreter with a switch (-q) and telling it to run the script called update-feeds.php. I can't find any documentation on the -q switch right now. And it's not clear to me why you would need to call the php interpreter directly since I would have thought php is already running.*

Having said all of that, be advised that I've only tried to set up a cron job once, had it blow up and put it on my list of Things To Get Back To. I haven't gotten back to it yet.

* In other words, I would have thought that having set the scheduling parameters in the fields provided, the command line would be (remember the /www/ is prepended to the field):

wp/wp-content/update-feeds.php

But that assumes php is running. It would also assume a default WordPress installation with the wp directory immediately under the www directory, wp-content immediately under that and the update-feeds.php script in that directory.

OK, that's two edits. Now I'm having lunch.

Mandos

  • Senior Member
  • *****
  • Posts: 5759
    • View Profile
    • http://politblogo.typepad.com/
Cron job
« Reply #16 on: November 10, 2006, 01:47:58 PM »
Yes, I've made it basically call the script.  The problem is that the script isn't working as such.

Debra

  • Administrator
  • Senior Member
  • *****
  • Posts: 11228
    • View Profile
    • April Reign
Cron job
« Reply #17 on: November 10, 2006, 01:51:15 PM »
I've been manually updating through the browser call up.

what about either of these methods?
Quote
If you don’t have access to (a), you can still save the day using another computer with always-on Internet access that sends a POST request to the update-feeds.php URI on a regular schedule. So, for example, if you have WordPress installed at http://www.zyx.com/blog, and you have a dummy user in your WordPress database with the login name ‘login’ and the password ‘pass’, then you could add the following line to the crontab on a home Linux box:

25 * * * * curl --user login:pass http://www.zyx.com/blog/wp-content/update-feeds.php -d update=quiet

The -d update=quiet switch ensures that (1) update-feeds.php will receive an HTTP POST request rather than an HTTP GET request (which is important, since it won’t take any actions with side-effects — such as checking for new posts — unless it receives an HTTP POST); it also tells it to suppress the HTML output that it would generate for normal web browsers, and only to output text if it encounters errors (this will keep the number of e-mails you receive from the Cron Daemon to a minimum).

If you are using Windows XP and have a version of curl (such as the version included in Cygwin), you can create a Scheduled Task to similar effect.
“Damaged people are dangerous. They know they can survive.” —  Josephine Hart

Mandos

  • Senior Member
  • *****
  • Posts: 5759
    • View Profile
    • http://politblogo.typepad.com/
Cron job
« Reply #18 on: November 10, 2006, 02:03:41 PM »
As long as it's using that script, it's the same problem.  I should be able to run the script manually and make it work before any of that will work.

 

Return To TAT