Cron Problems

Cron Problems

Posted by: bschneider55
Posted on: 2006-03-18 19:25:00

I am working to set up my forst cron and have encountered a bit of a snag. I edited the job to update a feed in wordpress, and the command saves but never executes. Here is the command line:


* * * * * cd/home/user/nfl-superbowl.net/wp-content ; php -q update-feeds.php

For a test I wanted it to run every minute, but will change once working.

My other question is, is the command line saving to the right file? When prompted to save, it writes to the file:

File Name to Write: /tmp/crontab.UMa9H2/crontab

Is this right?

Any help would be great!




Add a space and paths

Posted by: sdayman
Posted on: 2006-03-18 19:52:00

You need a space after the 'cd' command. You should also use the full path for the PHP commands:
* * * * * cd /home/user/nfl-superbowl.net/wp-content ; /usr/local/bin/php -q ./update-feeds.php


-Scott

Re: Add a space and paths

Posted by: bschneider55
Posted on: 2006-03-19 06:00:00

Hmm. Seems it is still not working. Do you have any other suggestions?

Re: Add a space and paths

Posted by: matttail
Posted on: 2006-03-19 07:38:00

You may need an extra line break after your command.

Also, to follw up with file it's saving, yes that's correct.


-MatttailEdited by matttail on 03/19/06 07:38 AM (server time).

Re: Add a space and paths

Posted by: bschneider55
Posted on: 2006-03-19 07:45:00

Wel, this is where I'm at now.

* * * * * cd /home/user/nfl-superbowl.net/wp-content ; /user/local/bin/php -q ./update-feeds.php/

Still not working. Any other ideas?

Re: Add a space and paths

Posted by: matttail
Posted on: 2006-03-19 07:49:00

try just running your command from shell. so just type:
cd /home/user/nfl-superbowl.net/wp-content ; /user/local/bin/php -q ./update-feeds.php/


And see if you get any errors, hopefully that will help you or someone here figure out what's wrong.

You can also check the E-mail address for the user you've loged in with for any errors that have already been sent out.



-Matttail

Re: Add a space and paths

Posted by: bschneider55
Posted on: 2006-03-19 07:49:00

Just thought I'd ask, where the text reads "user", should I leave it as such or should I enter my FTP user info?

Re: Add a space and paths

Posted by: matttail
Posted on: 2006-03-19 07:55:00

it should be the user for the domain. The user name you use to connect to the domain for FTP should be put in there instead of 'user'. That will make a big difference with gettings this command to work.



-Matttail

Re: Add a space and paths

Posted by: bschneider55
Posted on: 2006-03-19 08:02:00

I changed the text 'user' to the actual username and still nothing. This sucks!

Re: Add a space and paths

Posted by: norm1037
Posted on: 2006-03-19 08:38:00

Have you tried running it with full pathnames on all options so you have:

crontab -e

(Then type in..)

* * * * * cd /home/username/nfl-superbowl.net/wp-content ; /usr/local/bin/php -q /homeusername/nfl-superbowl.net/wp-content/update-feeds.php

(That is all on one lane and amend the pathname to where update-feeds.php actually is,and username is the ftp/cgi account username)

(Press return to leave a blank line)

Control-o to save then control-x to exit.

See how that goes.

That semi-colon in your line. Is it supposed to be there?



Re: Add a space and paths

Posted by: ardco
Posted on: 2006-03-19 09:20:00

> That semi-colon in your line. Is it supposed to be there?

Trying to do 2 commands in one line; I'm also wondering if that's ok?

Good luck,

BobS

Re: Add a space and paths

Posted by: bschneider55
Posted on: 2006-03-19 11:26:00

OK, I ran the command from the prompt and i worked, but still doesnt seem to run on a schedule. Here is the command I ran:

cd /home/user/nfl-superbowl.net/wp-content ; php -q update-feeds.php

Re: Add a space and paths

Posted by: ardco
Posted on: 2006-03-19 11:56:00

I'd put the following in a file, make it executable (chmod u+x filename), stick it somewhere like /home/user/mybin , and make the cron do /home/user/mybin/filename .

I'd also change it to only every 5 or 10 or 15 minutes for testing; every minute is really often.

In reply to:

cd /home/user/nfl-superbowl.net/wp-content

usr/local/bin/php -q ./update-feeds.php


Good luck,

BobS

Re: Add a space and paths

Posted by: norm1037
Posted on: 2006-03-19 12:00:00

Have you tried without the cd part and just the last part.

* * * * * /usr/local/bin/php%-q /home/username/nfl-superbowl.net/wp-content/update-feeds.php

Use % before any text input to a command in a crontab.

Tags: content phpcrontabcronsnagtmpjobcommand linefile name