Crontab issue


#1

I put the following in my crontab

0,10 * * * * cd $HOME/248pm.com/wp-content ; php -q update-feeds.php

supposed to do this every 10 minutes (planning on making it 30 once it works) but its not doing it. When i type the command (cd $HOME/248pm.com/wp-content ; php -q update-feeds.php) manually in shell it works.

am i doing something wrong? I am saving the wrong crontab file or something. when i quit crontab -e it asks me to save i say yes and it asks me if its this

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

i press enter. what am i doing wrong?

thanks


Use the coupon code [color=#CC0000]FIVEZEROOFF[/color] when signing up to Dreamhost for an instant [color=#CC0000]$50 off[/color]!


#2

The file you’re saving looks fine (crontab creates a temporary working copy to edit).

Try putting a MAILTO=your@email.address at the top of the crontab. Any errors running the command will be emailed to you. At the moment the errors should be going to the mailbox of your shell account.

The error might be a failure to find php due to cron getting a different PATH to a normal login. Try specifying the full path to php (/usr/local/bin/php).


#3

Your command is running at the begining of the hour (a minute 0) and the 10th minuet. You’ll also need to specify a full path to your php file. Instead of $HOME use /home/username/domain.com/wp-content (chance out username for your user name)

You are saving the file correctly.

-Matttail


#4

Alternatively, you can edit the PHP file you’re trying to run via cron, and put the following line at the beginning:

Then, chmod that file +x and schedule it to run as you would any other executible file. Might be easier than doing it the way you’ve been doing it. In fact, Dreamhost suggests this.

Yes, I have an opinion.

Get a minimum 50% off with the “haveadreamyday” promo code, and… have a dreamy day. Original, no?


#5

ok i am using this command now and its working

0,10 * * * * /usr/local/bin/php -q /home/usurp/248pm.com/wp-content/update-feeds.php

but u r saying this command runs at the begining of the hour, how can i make it run every 10 minutes instead?

thanks

markl


Use the coupon code [color=#CC0000]FIVEZEROOFF[/color] when signing up to Dreamhost for an instant [color=#CC0000]$50 off[/color]!


#6

The 0,10 says run on the 0th and 10th minute of every hour.

To run every 10 minutes, use */10 instead of 0,10:

*/10 * * * * /usr/local/bin/php -q /home/usurp/248pm.com/wp-content/update-feeds.php


#7

coooool thanks :slight_smile:


Use the coupon code [color=#CC0000]FIVEZEROOFF[/color] when signing up to Dreamhost for an instant [color=#CC0000]$50 off[/color]!