Crontab newbie


#1

Hi,
I have a Wordpress blog and I like to moblog so I found this plugin Postie .
I need to setup a cronjob to pull down the get_mail.php I tried the Cron Scheduled Tasks on the Web panel, in the window Command to run: I set the url to the php file like this:
http://mydomain/wordpress/wp-content/plugins/postie/get_mail.php
For the test period I set the 01 min of every hour, every day, every month, every day of the week.
I’m probably doing someting wrong here because I got a message "No such file or directory"
Now I’m receiving each hour a email that there is no such file or directory but the crontab is not pulling down the mail to my blog :frowning:

Can somebody tell me what I need to do or type in the command window? I’m newbie on this so maybe you can keep that in mind :blush:

In advance, thanks for your support!


#2

You probably need something like wget or curl before the URL. A URL by itself isn’t much of a command.


$1 for me << [color=#00CC00]SE7ENOF9[/color] | [color=#CC0000]SE7ENOF97[/color] >> All for you


#3

You are almost there, but you have to specify paths not urls in cron jobs, and with PHP you have to specify the path of the PHP interpreter also.

Atropos7 covers that pretty well in this thread. Additional more detailed information, and another approach, is described in this DH wiki article on running PHP from cron.

–rlparker


#4

So I need to copy the following code in the command window in the Web panel cronjob?
env /usr/local/bin/php –q /home/tejava/username/www.mydomain.com/wordpress/wp-content/plugins/postie/get_mail.php

Anything else or this should work?

Because it doesn’t seems to work I get
[i]Status: 404
X-Powered-By: PHP/4.4.4
Content-type: text/html

No input file specified.[/i]
BTW the first line in the get_mail.php is
#!/usr/bin/php -q

That was placed by the developer.

Hope you can give me some clue
Thanks


#5

You have the right idea, but you are not quite there. Your error message is telling you it cannot find the .PHP file.

This is understandable as your path is not correct (for a DH server). Your command line:

[quote]env /usr/local/bin/php –q /home/tejava/username/www.mydomain.com/wordpress/wp-content/plugins/postie/get_mail.php
[/quote]
should be using the names of the directories in the path to your .php file. For example, does your domains directory actually have a “www.” in front of it (on DH, most do not), and you have somekind of a problem with the “/tejava/username/” part, also - as, if “tejava” is your “dataglob”, it should either be omitted (preferred) or have a preceeding "period (/.tejava).

While I cannot see your directory structure, and do not actually know what your directory is named, I can’t tell you exactly what to put in there.

If your main web directory for your domain is named “mydomain.com” then:

env /usr/local/bin/php –q /home/yourusername/mydomain.com/wordpress/wp-content/plugins/postie/get_mail.php should work.

–rlparker


#6

I’m probably to stupid to get this working but I still can’t get it right. I have placed the following code in the command line:

env /usr/local/bin/php –q /home/username/www.bloggie.org/wordpress/wp-content/plugins/postie/get_mail.php

I still get the message:

Status: 404
X-Powered-By: PHP/4.4.4
Content-type: text/html

No input file specified.

With or without www it doesn’t make any difference. I thought I needed to add the name of the server also but I guess I don’t?
I first like to run it on my test site before I move it over, but for now it’s getting only frustrating instead of working


#7

Do you actually have a directory named www.blogie.org? Are you sure that the directory (not the domain) is not name just “blogie.org”?

Try your command line again, without the “www.” in front of “bloggie.org

–rlparker


#8

And bloggie, are you actually replacing “username” with your username?

Apologies if I’m being too paranoid, but I never like leaving things to chance if I can help it.

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options


#9

I was able to use the instructions at http://wiki.dreamhost.com/Run_PHP_from_cron to set up Postie to post pictures from my cell phone to my blog.

It seemed ugly at the time, but it seems to work reliably for me.

Rich

We don’t need no stinkin’ signature…


#10

Thanks, Rich, for re-iterating that point. While I mentioned it in my initial response to the original poster, I probably should have emphasized it more; If I had, he might have it all sorted by now! :wink:

It’s great that you caught it and jumped in to point him back in that direction. :slight_smile:

–rlparker


#11

Yes I did changed the word username in my “real” username thanks for notice :wink:


#12

I have entered this for a change :wink:

env /usr/local/bin/php –q /home/USERNAME/wordpress/wp-content/plugins/postie/get_mail.php

so no domain or www but no luck :s

I got to tell you I found myself such a nono at this point :stuck_out_tongue:


#13

Can you tell me what you did Rich?
What did you changed if you compare it to the instructions in other words tho you have the code lines somewhere?

Thanks for helping so far I hope I can get it working thanks to you guys


#14

Well, that wasn’t really what I meant; I only wanted you to drop the “www”. Your domain is probably set up to work with, or without, the “www” when browsing from the web (a URL), but for the purposes of the crontab, the actual name of the directory is important (and probably why you are getting an error message that indicates the file can’t be found!). Let’s try one more time :wink: :

If you have a directory named bloggie.org (which is the directory that is displayed when you browse to “http://www.bloggie.org/”) under your user directory, try this:

env /usr/local/bin/php –q /home/USERNAME/bloggie.org/wordpress/wp-content/plugins/postie/get_mail.php

If that doesn’t work, post back with the contents of your user directory (files and directories) of your user directory (the directory you are placed into when you connect via FTP), and we’ll take a look at how you are actually set up.

–rlparker


#15

I followed the instructions as shown on http://wiki.dreamhost.com/Run_PHP_from_cron exactly, from the very beginning - including, while logged in via the shell, creating a bin directory if you don’t already have one, running curl to get the site-check perl script shown under “We’re going to now install a little script” and editing the variables.

Basically, I guess cron really can’t browse the web because all it’s just a scheduler, and what you’re really trying to do is visit get_mail.php.

But the perl script “site-check.pl” can.

So after you plug in your two variables, then you can configure the cron job to run the perl script, not try to browse to get_mail.php.

It doesn’t say it, but it was as if those instructions were created SPECIFICALLY for situations like trying to run get_mail.php, where you need a web site to be visited to kick off a job, in the case of Postie, to force a mail check.

BTW, I configured my cron tab to only run the script once every 15 minutes, and even that is way too often. In the shared server environment, I didn’t want to try running something once every minute when I really didn’t need it. If I am sending pictures to the blog more often then once every 15 minutes, I need to find a new life.

We don’t need no stinkin’ signature…


#16

Again thanks for taking the time to help me out on this issue I really appreciate it a lot.

are like this:
bloggie.org
wordpress
wp-content
plugins
postie
get_mail.php
Is this what you mean rlparker?

Text below comes with the plugin
[i]
Setup a cronjob to pull down the get_mail.php
Example:
*/5 * * * * /usr/bin/lynx --source http://www.economysizegeek.com/wp-content/plugins/postie/get_mail.php >/dev/null 2>&1

This fetches the mail every five mintues.
[/i]

If I use those line I get also a error. Tried the code like you wrote down

but that had no luck


#17

Okay I finally found it!
I followed the Run PHP from Cron instructions was first a bit scary for that part but I took my time and it worked out great.

Thank all of you guys you have been a great help!!!


#18

Good Deal! And that was the “more better” approach to take! I’m glad you got it sorted! :slight_smile:

–rlparker