Web Hosting Forum | Lunarpages

Author Topic: cron question from a beginner  (Read 996 times)

Offline jfowle2

  • Newbie
  • *
  • Posts: 2
cron question from a beginner
« on: March 25, 2017, 09:05:59 AM »
OK, I'm a beginner and am not even sure I'm asking this question in the correct forum. I just received an email from Support saying that I need to schedule wp-cron.php to run every 10 minutes. Naturally, they send me this message at 5:35am on Saturday, knowing that Support doesn't operate via phone on the weekend. They tell me to "log into the system via terminal or another ssh client" and use the command "crontab -e" to enter:
 
0,10,20,30,40,50 * * * * /usr/bin/php/home/*****/public_html/wp-cron.php >dev/null 2>&1

First, I don't know how to "log into the system". Which system?

While poking around on cpanel, I see that I can set up a cron from cpanel|cron jobs, so I tried:
 
*/10 * * * * /usr/bin/php/home/*****/public_html/wp-cron.php (leaving off the ">dev/null 2>&1" so I can monitor the email msgs.)

but then I get the following email message every 10 minutes:

/usr/local/cpanel/bin/jailshell: /usr/bin/php/home/*****/public_html/wp-cron.php:
Not a directory

I don't know what they are telling me here. "*****" is the directory portion where my public_html/wp-cron.php is located. And what the heck is "jailshell"?

Alternatively, can I just edit the wp-cron.php file in my public_html directory and enter the command they gave me originally? Currently, there is nothing in that file when I edit it. Being a beginner, I would have expected to see the cron information I entered earlier.
 
So many questions; so little time... What is Plan B for me?  :-?

Thanks in advance,

Jim Fowler, Greenville, SC

[replaced your account name by *****. It's not a good idea to publicly expose your account name. -- Mod.]
« Last Edit: March 25, 2017, 02:14:44 PM by MrPhil »

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6225
Re: cron question from a beginner
« Reply #1 on: March 25, 2017, 02:11:44 PM »
There was a typo somewhere, and you smooshed the two parts of the command together. You also dropped / from /dev/null. It should be
Code: [Select]
/usr/bin/php  /home/*****/public_html/wp-cron.php  >/dev/null  2>&1Just plain "php" (instead of "/usr/bin/php") may work too.

You can omit the ">/dev/null" if you want to receive the results in your email (at the least the first few times, until you get bored of those emails).

Now, if wp-cron.php is empty, you probably won't get anything. I have no idea what's supposed to go into it.
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

Offline jfowle2

  • Newbie
  • *
  • Posts: 2
Re: cron question from a beginner
« Reply #2 on: March 25, 2017, 03:26:31 PM »
Thanks, MRPhil. I  appreciate your help. I am a literalist. I did exactly what you said and added the space after the first "php" as well as removing the "/dev/null". I left the remaining " 2>&1" because I do not understand its function, and figure it must be important in some way. Here is the command:
 
*/2 * * * * /usr/bin/php /home/jfowle2/public_html/wp-cron.php > 2>&1
 
and here is the resulting error msg.:
 
/usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token `2'
/usr/local/cpanel/bin/jailshell: -c: line 0: `/usr/bin/php
/home/jfowle2/public_html/wp-cron.php > 2>&1'

Looks like it doesn't know how to handle that last portion. So, in another iteration, I left that last part off:
 
*/2 * * * * /usr/bin/php /home/jfowle2/public_html/wp-cron.php
 
and here is the error msg.:
 
Status: 403 Forbidden
X-Powered-By: PHP/5.6.28
Content-type: text/html; charset=UTF-8

Access denied
.


I think we are making progress, but as I said, I am a raw beginner and am doing exactly what you recommended. I work well with explicit instructions when I neither understand the concepts nor the jargon.

Thanks for your help,

Jim

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6225
Re: cron question from a beginner
« Reply #3 on: March 26, 2017, 05:43:49 AM »
When I said to remove ">/dev/null", you forgot to remove the ">" with it.

Code: [Select]
/usr/bin/php  /home/jfowle2/public_html/wp-cron.php  2>&1
I'm not sure you need the "2>&1" either, but it probably doesn't hurt. Just so you understand what's going on, "2>&1" means "send standard ERROR messages [unit 2] to the same place as you send standard OUTPUT messages [unit 1]". ">/dev/null" means "send standard OUTPUT messages to the trash can (/dev/null) rather than letting them be captured and sent in the email". You don't want to do that while debugging, but can if cron emails just contain routine output that you can safely ignore.
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

 

Share |